背景,我正在对一些文档进行一些关键短语提取。这里我有一个术语列表,我想将其用作上传文档的方面(I did this),所以我有一个结肠癌术语列表,出现了一个问题,其中有10个文档有特定的术语,但我得到了400个文档,其中10个文档实际包含该术语,其他390个文档不包含该术语。我相信这是因为这个术语特别包含了另一个术语。
我正在查找的术语:,no evidence
还有一个实际上出现了400次的术语:,no
,类似地,我查找的是:,free of
,它在所有文档中出现了1次,但我得到了31个结果。有一个术语free
出现了31次。
以下是我的方案:
<field name="ColonCancer" type="ColonCancer" indexed="true" stored="true" multiValued="true"
termPositions="true"
termVectors="true"
termOffsets="true"/>
<fieldType name="ColonCancer" class="solr.TextField" sortMissingLast="true" omitNorms="true">
<analyzer>
<filter class="solr.ShingleFilterFactory"
minShingleSize="2" maxShingleSize="5"
outputUnigramsIfNoShingles="true"
/>
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms_ColonCancer.txt" ignoreCase="true" expand="true" tokenizerFactory="solr.KeywordTokenizerFactory"/>
<filter class="solr.KeepWordFilterFactory"
words="prefLabels_ColonCancer.txt" ignoreCase="true"/>
</analyzer>
</fieldType>
有没有办法让它的行为方式让我只看到正确的数量(没有证据显示只有10个结果)。
编辑:这似乎给了我想要的:
http://localhost:8983/solr/Cytokine/tvrh?q=%22no%22%20OR%20%22no%20evidence%22&fq=ColonCancer:no&fq=ColonCancer:no%20evidence&tv=true&tv.offsets=true
发布于 2015-12-07 00:31:45
您可以通过多种方式修复此问题。
您可以将该字段更改为字符串字段。这将把facet查询行为变成“特定的”。也就是说,寻找“没有证据”只会发现“没有证据”-区分大小写。
另一种选择是在寻找特定组合时使用facet查询。然后,您可以使用~ simbol来强制它们之间的范围。
示例:
<field name="ColonCancer" type="ColonCancer" indexed="true" stored="true" multiValued="true"
termPositions="true"
termVectors="true"
termOffsets="true"/>
<fieldType name="ColonCancerString" class="solr.StringField">
<analyzer>
<filter class="solr.ShingleFilterFactory"
minShingleSize="2" maxShingleSize="5"
outputUnigramsIfNoShingles="true"
/>
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms_ColonCancer.txt" ignoreCase="true" expand="true" tokenizerFactory="solr.KeywordTokenizerFactory"/>
<filter class="solr.KeepWordFilterFactory"
words="prefLabels_ColonCancer.txt" ignoreCase="true"/>
</analyzer>
</fieldType>
<copyField source="ColonCancer" dest="ColonCancerString"/>
在这里,我添加了另一个名为ColonCancerString的字段,它应该保存相同的文本-但作为字符串。
模式中的copyFIeld行告诉它复制字段值。
有关复制字段线程,请参阅此处:
https://stackoverflow.com/questions/34113992
复制相似问题