Difference between revisions of "LuceneFastDocument class"

From Catglobe Wiki
Jump to: navigation, search
(Created page with "{{CGscriptClass_Template |Name=<nowiki>LuceneFastDocument</nowiki> |Description=<nowiki>Document to used for fast indexing</nowiki> |Constructors= {{CGscriptConstructors_Templ...")
(Tag: visualeditor-switched)
 
Line 30: Line 30:
 
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}}
 
}}
 
}}
 +
=== <span style="color:#DF8621">'''Note'''</span> ===
 +
LuceneFastDocument should only have 1 constructor, the other constructors are not valid

Revision as of 08:04, 21 June 2017

LuceneFastDocument



Document to used for fast indexing

Constructors

  • (array fields "Fields that needs to be stored for this document", array storeValues "If true, the value for the given index can be extracted from the search result") - Initialize fast document for adding in loop. The doc instance can be reused in the loop for less memory usage and faster processing. Notice this sets some fields to empty or 0, where as the non-fast version doesnt include them in document at all

Methods

  • Empty AddField(LuceneColumn type "Which column to store value in", object value "Value to save", bool storeValue "If true, the value can be extracted from the search result") - Add a new field to the document. Multiple calls are valid for the same column, and it is not necessary to add values for all columns
  • object GetField(LuceneColumn type "Which column to get value from") - Get the values for a given field. Only valid if storeValue was true when updating the document
  • array GetFields(LuceneColumn type "Which column to get values from") - Get the values for a given field. Only valid if storeValue was true when updating the document
  • Empty Reset(string id "Id") - Reset and set a new Id. Must be called first in any iteration
  • Empty SetField(int fieldIndex "Index of which field to set value on", object value "Value to save") - Set a new field to the document. Multiple calls are valid for the same column, and it is not necessary to add values for all columns
  • string ToString() - The string representation of the object.

Properties

  • string Explain { get; set; } - Explain why the search found this document
  • string Id { get; } - Id of the document
  • string ObjectTypeName { get; } - The name of the type of object.
  • number ResultScore { get; } - The score generated by Lucene for this search result
  • TypeInformation TypeInformation { get; } - Get information about this class.

Note

LuceneFastDocument should only have 1 constructor, the other constructors are not valid