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

  • SEARCH
  • Home
  • 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 8106819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:34:54+00:00 2026-06-06T00:34:54+00:00

I am using compass based indexing on my project. My annotation based configuration for

  • 0

I am using compass based indexing on my project. My annotation based configuration for the field ‘name’ is :

@SearchableProperty(name="name")
@SearchableMetaData(name="ordering_name", index=Index.NOT_ANALYZED)
private String name;

Now following values are store for ‘name’ field :

1. Temp 0 New n/a
2. e/f search
3. c/d search

Now the search result with difference scenarios is as follows :

1. 'c/d' -> +(+alias:TempClass +(c/d*)) +(alias:TempClass) -> 1 record found
2. 'n/a' -> +(+alias:TempClass +(n/a*)) +(alias:TempClass) -> 0 record found
3. 'search' -> +(+alias:TempClass +(search*)) +(alias:TempClass) -> 2 records found

So when I am trying to search ‘n/a’, it should search the first record with value ‘Temp 0 New n/a’.

Any help would be highly appreciated !!!

  • 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-06-06T00:34:57+00:00Added an answer on June 6, 2026 at 12:34 am

    At some point your query analysis doesn’t match with your Document analysis.

    Most likely you are internally using Lucene’s StandardAnalyzer on the query parsing but not at index time, as detonated by:

    @SearchableMetaData(name="ordering_name", index=Index.NOT_ANALYZED))
    

    The StandardTokenizer used inside this analyzer considers the character / as a word boundary (such as space would be), producing the tokens n and a. Later on, the token a is removed by a StopFilter.

    The following code is an example for this explanation (the input is "c/d e/f n/a"):

    Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_36);
    TokenStream tokenStream = analyzer.tokenStream("CONTENT", new StringReader("c/d e/f n/a"));
    CharTermAttribute term = tokenStream.getAttribute(CharTermAttribute.class);
    PositionIncrementAttribute position = tokenStream.getAttribute(PositionIncrementAttribute.class);
    int pos = 0;
    while (tokenStream.incrementToken()) {
        String termStr = term.toString();
        int incr = position.getPositionIncrement();
        if (incr == 0 ) {
            System.out.print(" [" + termStr + "]");
        } else {
            pos += incr;
            System.out.println(" " + pos + ": [" + termStr +"]");
        }
    }
    

    You’ll see the following extracted tokens:

     1: [c]
     2: [d]
     3: [e]
     4: [f]
     5: [n]
    

    Notice that the expected position 6: with token a is missing. As you can see, Lucene’s QueryParser also performs this tokenization:

    QueryParser parser = new QueryParser(Version.LUCENE_36, "content", new StandardAnalyzer(Version.LUCENE_36));
    System.out.println(parser.parse("+n/a*"));
    

    The output is:

    +content:n
    

    EDIT: The solution would be to use WhitespaceAnalyzer, and set the field to ANALYZED. The following code is a proof of concept under Lucene:

    IndexWriter writer = new IndexWriter(new RAMDirectory(), new IndexWriterConfig(Version.LUCENE_36, new WhitespaceAnalyzer(Version.LUCENE_36)));
    Document doc = new Document();
    doc.add(new Field("content","Temp 0 New n/a", Store.YES, Index.ANALYZED));
    writer.addDocument(doc);
    writer.commit();
    IndexReader reader = IndexReader.open(writer, true);
    IndexSearcher searcher = new IndexSearcher(reader);
    BooleanQuery query = new BooleanQuery();
    QueryParser parser = new QueryParser(Version.LUCENE_36, "content", new WhitespaceAnalyzer(Version.LUCENE_36));
    TopDocs docs = searcher.search(parser.parse("+n/a"), 10);
    System.out.println(docs.totalHits);
    writer.close();
    

    The output is: 1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using compass based indexing on my project. Now in one of the
Note: This question refers to a Rails project with Sass & Compass. Using the
I'm using Sass 3.1.10 with Compass 0.11.5. I need to compile my compass project
In my Rails 3.2.1 application I am using compass(0.12.alpha.4) to create sprites: @import compass
Know if it's possible to access the iPhone compass in Safari using JavaScript? I
I've been using compass from http://compass-style.org/ to manage my sites css for a long
I need to map a collection of components with compass (using XML mapping)... Is
I have a compass application which is using orientation sensor and every time the
(this is in a Java project) I'm using a search engine in parallel with
I'm using Compass to generate linear gradients but I'm getting a strange error indicating

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.