Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6978277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:44:03+00:00 2026-05-27T17:44:03+00:00

Say – if I has the query content:table AND propertyfield:now how can i get

  • 0

Say – if I has the query

content:table AND propertyfield:now

how can i get two of this items for proper examining later?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:44:04+00:00Added an answer on May 27, 2026 at 5:44 pm

    Here you go (I use Java, sorry 😉

    package stack.lucene;
    
    import junit.framework.TestCase;
    
    import org.apache.lucene.analysis.standard.StandardAnalyzer;
    import org.apache.lucene.queryParser.QueryParser;
    import org.apache.lucene.search.BooleanClause;
    import org.apache.lucene.search.BooleanQuery;
    import org.apache.lucene.search.Query;
    import org.apache.lucene.util.Version;
    
    public class StackLucene2 extends TestCase
    {
        private String sQuery = "field1:playing AND (field2:curse OR field3:something) AND field4:somethingother OR field5:blah";
    
        public void testQueryParser() throws Exception 
        {
            QueryParser parser = new QueryParser(Version.LUCENE_CURRENT, null, new StandardAnalyzer(Version.LUCENE_CURRENT));
            Query q = parser.parse(this.sQuery);
    
            if( q.getClass() == BooleanQuery.class ){
                breakQuery_recursive(q, 0);
            }
        }
    
        // level is for indentation
        private void breakQuery_recursive(Query q, int level)
        {
            BooleanQuery castQuery = (BooleanQuery)q;
            for(BooleanClause clause : castQuery.getClauses() ){
                Class queryclazz = clause.getQuery().getClass();
    
                System.out.println(repeat(' ', level) + "["+queryclazz+"][" + clause.getOccur() + "] " + clause.toString());
    
                if(queryclazz == BooleanQuery.class) {
                    breakQuery_recursive(clause.getQuery(), level+1);
                }
            }
        }
    
        private String repeat(char c, int times)
        {
            StringBuffer b = new StringBuffer();
            for(int i=0;i < times;i++){
                b.append(c);
            }
            return b.toString();
        }
    }
    

    Output:

    [class org.apache.lucene.search.TermQuery][+] +field1:playing
    [class org.apache.lucene.search.BooleanQuery][+] +field2:curse field3:something
     [class org.apache.lucene.search.TermQuery][] field2:curse
     [class org.apache.lucene.search.TermQuery][] field3:something
    [class org.apache.lucene.search.TermQuery][+] +field4:somethingother
    [class org.apache.lucene.search.TermQuery][] field5:blah
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a LINQ-to-XML query that generates an anonymous type like this: var
Say my web app has two spring cron jobs scheduled to run every minute/hour.
Say, the field of Race in my table has values like W,A (white and
Say with the below awk inside a bash script: How can you get the
say i have a nvarchar field in my database that looks like this 1,
Say I write this: from subprocessing import Popen, STDOUT, PIPE p = Popen([myproc], stderr=STDOUT,
Say you're building a Tetris game. As any proper programmer, you have your view
Say we have two tables in an MS Access db: Service Users: | ID
Say I have a SqlAlchemy model something like this: from sqlalchemy.ext.declarative import declarative_base from
Say I want to test this module: import osutils def check_ip6(xml): ib_output = osutils.call('iconfig

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.