How to set up a query to return phrases and parts of phrases in lucene.net?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 04:15:11

问题


I've got lucene.net running and I am having a little trouble with implementing a good approach to a query requirement that I have.

I'd like to be able to create a query that would enable the query to find hits on:

1) "Sodium Bicarbonate" - exact phrase query.

2) "Sodi% Bicarb%" - partial phrase query that at least has these letters.

3) "sodium,Sodium Bicarbonate, sulfur" - find exact phrase in a bigger phrase set with a form like 1) or 2).

This query will be applied to two fields in the document. I've got the exact phrase query coded but need more flexibility. I have a standard analyzer that has a multifieldparser using a phrasequery object.

I can talk about this on a more conceptual level but would like to see some code samples, especially dealing with query construction.

thanks all

来源:https://stackoverflow.com/questions/27851113/how-to-set-up-a-query-to-return-phrases-and-parts-of-phrases-in-lucene-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!