我正在尝试使用一些我知道已编入索引的特定单词对 Lucene 索引进行搜索,但结果不是很好。
如何对特定术语(“129202”)执行查询?我尝试在字符串的开头添加加号,但它不起作用。
我的查询:
QueryParser q = new QueryParser(Version.LUCENE_42, "tags", new SimpleAnalyzer(Version.LUCENE_42));
Query query = q.parse("sapatilha feminina ramarim 129202 cinza");
下面是我想要获取的索引文档(xml)
<?xml version="1.0" encoding="UTF-8"?>
<product>
<tags>
<tag>Sapatilha Pedras Preto</tag>
<tag>ramarin</tag>
<tag>ramarin 129202</tag>
<tag>preto</tag>
</tags>
<id>71</id>
<url>http://www.dafiti.com.br/Sapatilha-Pedras-Preto-1135428.html</url>
</product>