javascript代码处的SOLR查询问题

时间:2019-03-04 06:42:13

标签: solr

我在solr中有一个查询问题。我有一个包含多值数据的csv文件,想要像sql查询一样区分它们。但是有一些问题。当我在查询中进行刻面操作时,它可以在网络浏览器(chrome)上运行,但是我将其放置在eclipse javascript代码上却无法正常工作。我不明白为什么

这是我的schema.xml schema.xml

和我的JavaScript代码 javascript code

当查询在javascript代码中是这样时ngram结果是这样

ngram results

我想区分它们,但是查询在javascript中不起作用

1 个答案:

答案 0 :(得分:0)

Payload

javascript代码

   schema.xml


<field name="NameAdded" type="text_general" indexed="true" stored="true"/>
    <field name="DateAdded" type="date" indexed="true" stored="true"/>
    <field name="NameModified" type="text_general" indexed="true" stored="true"/>
    <field name="DateModified" type="date" indexed="true" stored="true"/>
    <field name="strSO" type="text_general" indexed="true" stored="true"/>
    <field name="strCust" type="text_general" indexed="true" stored="true"/>
    <field name="strOperator" type="text_general" indexed="true" stored="true"/>
    <field name="PackName" type="text_general" indexed="true" stored="true"/>
    <field name="DocName" type="text_general" indexed="true" stored="true"/>
    <field name="DocType" type="text_general" indexed="true" stored="true"/>
    <field name="extType" type="text_general" indexed="true" stored="true"/>
    <field name="FileName" type="text_general" indexed="true" stored="true"/>
    <field name="FilePath" type="text_general" indexed="true" stored="true"/>
    <field name="NameDeleted" type="text_general" indexed="true" stored="true"/>
    <field name="DateDeleted" type="date" indexed="true" stored="true"/>
    <field name="intRev" type="text_general" indexed="true" stored="true"/>

    <field name="strSO_ngram" type="text_ngram" indexed="true" stored="true"/>
    <field name="PackName_ngram" type="text_ngram" indexed="true" stored="true"/>
    <field name="DocType_ngram" type="text_ngram" indexed="true" stored="true"/>



        <!-- Added for NGram field-->
    <fieldType name="text_ngram" class="solr.TextField" positionIncrementGap="100">
    <analyzer type="index">
    <tokenizer class="solr.NGramTokenizerFactory" minGramSize="1" maxGramSize="20"/>    
    <filter class="solr.LowerCaseFilterFactory"/>
    </analyzer>
    <analyzer type="query">
    <tokenizer class="solr.EdgeNGramTokenizerFactory" minGramSize="1" maxGramSize="20"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    </analyzer>
    </fieldType>



    <!--
    <copyField source="title" dest="text"/>
    <copyField source="body" dest="text"/>
    -->
    <copyField source="strSO" dest="strSO_ngram"/>
    <copyField source="PackName" dest="PackName_ngram"/>
    <copyField source="DocType" dest="DocType_ngram"/>