java - How to determine In which indexed fields a token has matched? -


i search fields of objects "hibernate search".

my query:

 final org.apache.lucene.search.query lucenequery = qb           .keyword().wildcard()           .onfields( fields )           .matching( valuetosearch )           .createquery();   // wrap lucene query in javax.persistence.query  final javax.persistence.query jpaquery =             fulltextentitymanager.createfulltextquery( lucenequery, vorgang.class );   // execute search  final list<vorgang> resultlist = new arraylist<>();   ((list<vorgang>) jpaquery.getresultlist()).stream().filter( t -> projektids.contains( t.getprojektfk().getid() ) )             .foreach( vorgang -> resultlist.add( vorgang ) ); 

i want know in fields there match?

my idea was:

final list<vorgang> resultlist = new arraylist<>(); ( final string field : fields ) {    final org.apache.lucene.search.query lucenequery = qb           .keyword().wildcard()           .onfield( field )           .matching( valuetosearch )           .createquery();     // wrap lucene query in javax.persistence.query    final javax.persistence.query jpaquery =           fulltextentitymanager.createfulltextquery( lucenequery, vorgang.class );     // execute search    ((list<vorgang>) jpaquery.getresultlist()).stream().filter( t -> projektids.contains( t.getprojektfk().getid() ) )           .foreach( vorgang -> resultlist.add( vorgang ) ); } 

but performance not good. want know fields, there match.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -