Hi,
Thank you very much.. that should help.. meanwhile I run cases
and write again if I get stuck once more in the same context.
Thanks
2009/12/28 AHMET ARSLAN <[email protected]>:
>> Hello All,
>> I have observed
>> extractTerms() in the class
>> org.apache.lucene.search.Query which returns set of terms
>> extracted
>> from user input query. Is there any chance of getting the
>> connecting-operator between all those terms. for example..
>> Term1 OR
>> Term2 AND Term3 .. or Term1 AND Term2
>> AND Term3 , etc..
>> Thanks.
>
> You can extract org.apache.lucene.search.BooleanClause from BooleanQuery.
> Something like:
>
>
> if (contents instanceof BooleanQuery) {
>
> BooleanQuery bq = (BooleanQuery) contents;
> BooleanClause[] bclauses = bq.getClauses();
>
> for (int i = 0; i < bclauses.length; i++) {
>
> Query qc = bclauses[i].getQuery();
>
>
> if
> (bclauses[i].getOccur().equals(BooleanClause.Occur.MUST_NOT)) {
> // NOT
>
> }
> else if
> (bclauses[i].getOccur().equals(BooleanClause.Occur.MUST)) {
> // AND
>
> }
> else if
> (bclauses[i].getOccur().equals(BooleanClause.Occur.SHOULD)) {
> // OR
>
> }
> }
> }
>
> Hope this helps.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]