Not able to Search on Solr Field Type="text_general_maxlength"? -
i new solr field type="text_general_maxlength"
on not able search. tried using <copyfield>
mention field type "string"
didn't work. giving schema.xml.
please let me know doing wrong or have make question more specific. in advance
<schema name="hadoop-logs-schema" version="1.5">
<fields>
<field name="msg" type="string" indexed="true" stored="false" multivalued="true"/>
<field name="id" type="string" indexed="true" stored="true" required="true" multivalued="false" />
<field name="cluster" type="string" multivalued="false" docvalues="true"/>
<field name="rowtype" type="string" multivalued="false" docvalues="true"/>
<field name="level" type="string" docvalues="true" multivalued="false"/>
<field name="line_number" type="tint" omitnorms="false"/>
<field name="log_message" type="text_general_maxlength" omitnorms="false" multivalued="false"/>
<field name="file" type="string" docvalues="true" multivalued="false"/>
<field name="host" type="string" docvalues="true" multivalued="false"/>
<field name="logger_name" type="string" docvalues="true" multivalued="false"/>
<field name="logtime" type="tdate" multivalued="false"/>
<field name="logtype" type="string" docvalues="true" multivalued="false"/>
<field name="message" type="string" indexed="true" stored="true"/>
<field name="method" type="string" omitnorms="false" multivalued="false"/>
<field name="path" type="string" docvalues="true" multivalued="false"/>
<field name="seq_num" type="tlong" omitnorms="false" multivalued="false"/>
<field name="tags" type="string" multivalued="true"/>
<field name="thread_name" type="string" omitnorms="false" multivalued="false"/>
<field name="type" type="string" docvalues="true" multivalued="false"/>
</fields> <copyfield source="log_message" dest="msg"/>
<uniquekey>id</uniquekey>
<types> <!-- custom --> <fieldtype name="loglevel" class="solr.enumfield" enumsconfig="enumsconfig.xml" enumname="log_levels"/> <fieldtype name="text_general_maxlen" class="solr.textfield" positionincrementgap="100" multivalued="false"> <analyzer> <tokenizer class="solr.whitespacetokenizerfactory"/> <filter class="solr.lengthfilterfactory" min="0" max="32766"/> </analyzer> <analyzer type="index"> <tokenizer class="solr.standardtokenizerfactory"/> <filter class="solr.stopfilterfactory" ignorecase="true" words="stopwords.txt" /> <!-- in example, use synonyms @ query time <filter class="solr.synonymfilterfactory" synonyms="index_synonyms.txt" ignorecase="true" expand="false"/> --> <filter class="solr.lowercasefilterfactory"/> </analyzer> <analyzer type="query"> <tokenizer class="solr.standardtokenizerfactory"/> <filter class="solr.stopfilterfactory" ignorecase="true" words="stopwords.txt" /> <filter class="solr.synonymfilterfactory" synonyms="synonyms.txt" ignorecase="true" expand="true"/> <filter class="solr.lowercasefilterfactory"/> </analyzer> </fieldtype>
`
<!-- boolean type: "true" or "false" --> <fieldtype name="boolean" class="solr.boolfield" sortmissinglast="true"/> <fieldtype name="booleans" class="solr.boolfield" sortmissinglast="true" multivalued="true"/> <fieldtype name="int" class="solr.trieintfield" precisionstep="0" positionincrementgap="0"/> <fieldtype name="float" class="solr.triefloatfield" precisionstep="0" positionincrementgap="0"/> <fieldtype name="long" class="solr.trielongfield" precisionstep="0" positionincrementgap="0"/> <fieldtype name="double" class="solr.triedoublefield" precisionstep="0" positionincrementgap="0"/> <fieldtype name="tint" class="solr.trieintfield" precisionstep="8" positionincrementgap="0"/> <fieldtype name="tfloat" class="solr.triefloatfield" precisionstep="8" positionincrementgap="0"/> <fieldtype name="tlong" class="solr.trielongfield" precisionstep="8" positionincrementgap="0"/> <fieldtype name="tdouble" class="solr.triedoublefield" precisionstep="8" positionincrementgap="0"/> <fieldtype name="tints" class="solr.trieintfield" precisionstep="8" positionincrementgap="0" multivalued="true"/> <fieldtype name="tfloats" class="solr.triefloatfield" precisionstep="8" positionincrementgap="0" multivalued="true"/> <fieldtype name="tlongs" class="solr.trielongfield" precisionstep="8" positionincrementgap="0" multivalued="true"/> <fieldtype name="tdoubles" class="solr.triedoublefield" precisionstep="8" positionincrementgap="0" multivalued="true"/> <fieldtype name="date" class="solr.triedatefield" precisionstep="0" positionincrementgap="0"/> <!-- trie based date field faster date range queries , date faceting. --> <fieldtype name="tdate" class="solr.triedatefield" precisionstep="6" positionincrementgap="0"/> <fieldtype name="tdates" class="solr.triedatefield" precisionstep="6" positionincrementgap="0" multivalued="true"/> <!--binary data type. data should sent/retrieved in base64 encoded strings --> <fieldtype name="binary" class="solr.binaryfield"/> <fieldtype name="pint" class="solr.intfield"/> <fieldtype name="plong" class="solr.longfield"/> <fieldtype name="pfloat" class="solr.floatfield"/> <fieldtype name="pdouble" class="solr.doublefield"/> <fieldtype name="pdate" class="solr.datefield" sortmissinglast="true"/> <fieldtype name="random" class="solr.randomsortfield" indexed="true" /> <!-- text field splits on whitespace exact matching of words --> <fieldtype name="text_ws" class="solr.textfield" positionincrementgap="100"> <analyzer> <tokenizer class="solr.whitespacetokenizerfactory"/> </analyzer> </fieldtype> <!-- general text field has reasonable, generic cross-language defaults: tokenizes standardtokenizer, removes stop words case-insensitive "stopwords.txt" (empty default), , down cases. @ query time only, applies synonyms. --> <fieldtype name="text_general" class="solr.textfield" positionincrementgap="100" multivalued="true"> <analyzer type="index"> <tokenizer class="solr.standardtokenizerfactory"/> <filter class="solr.stopfilterfactory" ignorecase="true" words="stopwords.txt" /> <!-- in example, use synonyms @ query time <filter class="solr.synonymfilterfactory" synonyms="index_synonyms.txt" ignorecase="true" expand="false"/> --> <filter class="solr.lowercasefilterfactory"/> </analyzer> <analyzer type="query"> <tokenizer class="solr.standardtokenizerfactory"/> <filter class="solr.stopfilterfactory" ignorecase="true" words="stopwords.txt" /> <filter class="solr.synonymfilterfactory" synonyms="synonyms.txt" ignorecase="true" expand="true"/> <filter class="solr.lowercasefilterfactory"/> </analyzer> </fieldtype> <fieldtype name="text_en" class="solr.textfield" positionincrementgap="100"> <analyzer type="index"> <tokenizer class="solr.standardtokenizerfactory"/> <!-- in example, use synonyms @ query time <filter class="solr.synonymfilterfactory" synonyms="index_synonyms.txt" ignorecase="true" expand="false"/> --> <!-- case insensitive stop word removal. --> <filter class="solr.stopfilterfactory" ignorecase="true" words="lang/stopwords_en.txt" /> <filter class="solr.lowercasefilterfactory"/> <filter class="solr.englishpossessivefilterfactory"/> <filter class="solr.keywordmarkerfilterfactory" protected="protwords.txt"/> <!-- optionally may want use less aggressive stemmer instead of porterstemfilterfactory: <filter class="solr.englishminimalstemfilterfactory"/> --> <filter class="solr.porterstemfilterfactory"/> </analyzer> <analyzer type="query"> <tokenizer class="solr.standardtokenizerfactory"/> <filter class="solr.synonymfilterfactory" synonyms="synonyms.txt" ignorecase="true" expand="true"/> <filter class="solr.stopfilterfactory" ignorecase="true" words="lang/stopwords_en.txt" /> <filter class="solr.lowercasefilterfactory"/> <filter class="solr.englishpossessivefilterfactory"/> <filter class="solr.keywordmarkerfilterfactory" protected="protwords.txt"/> <!-- optionally may want use less aggressive stemmer instead of porterstemfilterfactory: <filter class="solr.englishminimalstemfilterfactory"/> --> <filter class="solr.porterstemfilterfactory"/> </analyzer> </fieldtype> <fieldtype name="text_en_splitting" class="solr.textfield" positionincrementgap="100" autogeneratephrasequeries="true"> <analyzer type="index"> <tokenizer class="solr.whitespacetokenizerfactory"/> <!-- in example, use synonyms @ query time <filter class="solr.synonymfilterfactory" synonyms="index_synonyms.txt" ignorecase="true" expand="false"/> --> <!-- case insensitive stop word removal. --> <filter class="solr.stopfilterfactory" ignorecase="true" words="lang/stopwords_en.txt" /> <filter class="solr.worddelimiterfilterfactory" generatewordparts="1" generatenumberparts="1" catenatewords="1" catenatenumbers="1" catenateall="0" splitoncasechange="1"/> <filter class="solr.lowercasefilterfactory"/> <filter class="solr.keywordmarkerfilterfactory" protected="protwords.txt"/> <filter class="solr.porterstemfilterfactory"/> </analyzer> <analyzer type="query"> <tokenizer class="solr.whitespacetokenizerfactory"/> <filter class="solr.synonymfilterfactory" synonyms="synonyms.txt" ignorecase="true" expand="true"/> <filter class="solr.stopfilterfactory" ignorecase="true" words="lang/stopwords_en.txt" /> <filter class="solr.worddelimiterfilterfactory" generatewordparts="1" generatenumberparts="1" catenatewords="0" catenatenumbers="0" catenateall="0" splitoncasechange="1"/> <filter class="solr.lowercasefilterfactory"/> <filter class="solr.keywordmarkerfilterfactory" protected="protwords.txt"/> <filter class="solr.porterstemfilterfactory"/> </analyzer> </fieldtype> <!-- less flexible matching, less false matches. not ideal product names, may skus. can insert dashes in wrong place , still match. --> <fieldtype name="text_en_splitting_tight" class="solr.textfield" positionincrementgap="100" autogeneratephrasequeries="true"> <analyzer> <tokenizer class="solr.whitespacetokenizerfactory"/> <filter class="solr.synonymfilterfactory" synonyms="synonyms.txt" ignorecase="true" expand="false"/> <filter class="solr.stopfilterfactory" ignorecase="true" words="lang/stopwords_en.txt"/> <filter class="solr.worddelimiterfilterfactory" generatewordparts="0" generatenumberparts="0" catenatewords="1" catenatenumbers="1" catenateall="0"/> <filter class="solr.lowercasefilterfactory"/> <filter class="solr.keywordmarkerfilterfactory" protected="protwords.txt"/> <filter class="solr.englishminimalstemfilterfactory"/> <!-- filter can remove duplicate tokens appear @ same position - possible worddelimiterfilter in conjuncton stemming. --> <filter class="solr.removeduplicatestokenfilterfactory"/> </analyzer> </fieldtype> <!-- text_general except reverses characters of each token, enable more efficient leading wildcard queries. --> <fieldtype name="text_general_rev" class="solr.textfield" positionincrementgap="100"> <analyzer type="index"> <tokenizer class="solr.standardtokenizerfactory"/> <filter class="solr.stopfilterfactory" ignorecase="true" words="stopwords.txt" /> <filter class="solr.lowercasefilterfactory"/> <filter class="solr.reversedwildcardfilterfactory" withoriginal="true" maxposasterisk="3" maxposquestion="2" maxfractionasterisk="0.33"/> </analyzer> <analyzer type="query"> <tokenizer class="solr.standardtokenizerfactory"/> <filter class="solr.synonymfilterfactory" synonyms="synonyms.txt" ignorecase="true" expand="true"/> <filter class="solr.stopfilterfactory" ignorecase="true" words="stopwords.txt" /> <filter class="solr.lowercasefilterfactory"/> </analyzer> </fieldtype> <fieldtype name="alphaonlysort" class="solr.textfield" sortmissinglast="true" omitnorms="true"> <analyzer> <!-- keywordtokenizer no actual tokenizing, entire input string preserved single token --> <tokenizer class="solr.keywordtokenizerfactory"/> <!-- lowercase tokenfilter expect, can when want sorting case insensitive --> <filter class="solr.lowercasefilterfactory" /> <!-- trimfilter removes leading or trailing whitespace --> <filter class="solr.trimfilterfactory" /> <filter class="solr.patternreplacefilterfactory" pattern="([^a-z])" replacement="" replace="all" /> </analyzer> </fieldtype> <fieldtype name="phonetic" stored="false" indexed="true" class="solr.textfield" > <analyzer> <tokenizer class="solr.standardtokenizerfactory"/> <filter class="solr.doublemetaphonefilterfactory" inject="false"/> </analyzer> </fieldtype> <fieldtype name="payloads" stored="false" indexed="true" class="solr.textfield" > <analyzer> <tokenizer class="solr.whitespacetokenizerfactory"/> <!-- delimitedpayloadtokenfilter can put payloads on tokens... example, token of "foo|1.4" indexed "foo" payload of 1.4f attributes of delimitedpayloadtokenfilterfactory : "delimiter" - 1 character delimiter. default | (pipe) "encoder" - how encode following value playload float -> org.apache.lucene.analysis.payloads.floatencoder, integer -> o.a.l.a.p.integerencoder identity -> o.a.l.a.p.identityencoder qualified class name implementing payloadencoder, encoder must have no arg constructor. --> <filter class="solr.delimitedpayloadtokenfilterfactory" encoder="float"/> </analyzer> </fieldtype> <!-- lowercases entire field value, keeping single token. --> <fieldtype name="lowercase" class="solr.textfield" positionincrementgap="100"> <analyzer> <tokenizer class="solr.keywordtokenizerfactory"/> <filter class="solr.lowercasefilterfactory" /> </analyzer> </fieldtype> <!-- example of using pathhierarchytokenizerfactory @ index time, queries paths match documents @ path, or in descendent paths --> <fieldtype name="descendent_path" class="solr.textfield"> <analyzer type="index"> <tokenizer class="solr.pathhierarchytokenizerfactory" delimiter="/" /> </analyzer> <analyzer type="query"> <tokenizer class="solr.keywordtokenizerfactory" /> </analyzer> </fieldtype> <fieldtype name="ancestor_path" class="solr.textfield"> <analyzer type="index"> <tokenizer class="solr.keywordtokenizerfactory" /> </analyzer> <analyzer type="query"> <tokenizer class="solr.pathhierarchytokenizerfactory" delimiter="/" /> </analyzer> </fieldtype> <fieldtype name="ignored" stored="false" indexed="false" multivalued="true" class="solr.strfield" /> <fieldtype name="point" class="solr.pointtype" dimension="2" subfieldsuffix="_d"/> <!-- specialized field geospatial search. if indexed, fieldtype must not multivalued. --> <fieldtype name="location" class="solr.latlontype" subfieldsuffix="_coordinate"/> <fieldtype name="location_rpt" class="solr.spatialrecursiveprefixtreefieldtype" geo="true" disterrpct="0.025" maxdisterr="0.000009" units="degrees" /> <fieldtype name="currency" class="solr.currencyfield" precisionstep="8" defaultcurrency="usd" currencyconfig="currency.xml" />
`
you have not mentioned indexed="true" stored="true"
change
<field name="log_message" type="text_general_maxlength" omitnorms="false" multivalued="false"/>
to
<field name="log_message" type="text_general_maxlength" omitnorms="false" indexed="true" stored="true" multivalued="false"/>
add entry shown above , reindex , try search.
as long want search on field needs indexed.
Comments
Post a Comment