i haven't found the answer to my problem so I decided to write my question to get some help.
I use lucene to index the objects in computer memory(they exist only in my java code). While processing the code I index (using WhitespaceAnalyzer
) the field with value objA/4
.
My problem starts when I want to find it after the indexation (also using WhitespaceAnalyzer
).
When i create a query obj*
, I find all objects that start with obj - if i create a query objA/4
I also can find this object.
However i don't know how to find all objects starting with objA/
, when I create a query objA/*
lucene is changing it to obja/*
and finds nothing.
I've checked and "/" is not a special character so i dont need any "\\" preceding it.
So my question is how to ask to get all objects that starts with objA/
(for example - objA/0
, objA/1
, objA/2
, objA/3
)?
您是否使用QueryParser.escape(String)
正确转义所有内容?
The code i'm using:
String node = "objA/*";
Query node_query = MultiFieldQueryParser.parse(node, "nodeName", new WhitespaceAnalyzer());
BooleanQuery bq = new BooleanQuery();
bq.add(node_query, BooleanClause.Occur.MUST);
System.out.println("We're asking for - " + bq);
IndexSearcher looker = new IndexSearcher(rep_index);
Hits hits = looker.search(bq);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.