views:

234

answers:

2

There are two tables with no relation defined eg : Bugs and Comments

For each bug id there are multiple comments.Suppose I am using a query like

  • select b.bugid,b.bugtitle,c.comment from bugs b , comments c where b.bugid = c.bugid

In hibernate search ,is there any method to write text queries for multifield searches ?

In case, for a search :- title:h* + comm:exce*

I used this code

      MultiFieldQueryParser mparser =   new MultiFieldQueryParser(new String[]
     { "comm",   "title" },new StandardAnalyzer());
    Query q = mparser.parse("title:h* + comm:exce*");
    FullTextQuery fq =fs.createFullTextQuery(q,org.sample.hibsearch.data.entity.LongDesc.class,
                            org.sample.hibsearch.data.entity.Bug.class);

When i tried this the code resluts two entities ie execute two hqls than a single one i expected .

Is there any solution for these type of scenarios?

A: 

As per this page:

http://lucene.apache.org/java/2_3_2/queryparsersyntax.html

it should be

title:h* OR comm:exce*

bwobbones
A: 

Same question was asked on the Hibernate Search Forum - https://forum.hibernate.org/viewtopic.php?f=9&t=1001326

Hardy