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 7768283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:52:53+00:00 2026-06-01T15:52:53+00:00

I’m indexing and searching code using a custom analyzer. Given text will wi-fi work,

  • 0

I’m indexing and searching code using a custom analyzer. Given text “will wi-fi work”, following tokens are generated (‘will’ being a stop-word, is eliminated).

wi-fi {position:2 start:5 end:10}
wifi {position:2 start:5 end:10}
wi {position:2 start:5 end:7}
fi {position:2 start:8 end:10}
work {position:3 start:11 end:15}

When I search for terms wi-fi, work I get search results. However, when I issue any query (phrase/non-phrase) for wifi, wi, fi I don’t get any results. Is there anything wrong with the generated tokens?

Parsed search queries:

For wi-fi (works fine)

Lucene's: +matchAllDocs:true +(alltext:wi-fi alltext:wifi alltext:wi alltext:fi)

For wifi (no results returned)

Lucene's: +matchAllDocs:true +alltext:wifi

For “will wi-fi work” (works fine)

Lucene's: +matchAllDocs:true +alltext:"(wi-fi wifi wi fi) work"

For “will wifi work” (no results returned)

Lucene's: +matchAllDocs:true +alltext:"? wifi work"

UPDATE

Found the issue:

public boolean incrementToken() throws IOException
{
    /*
     * first return all tokens in the list
     */
    if (tokens.size() > 0)
    {
        Token top = tokens.removeFirst();
        restoreState(current);
        **termAtt.setEmpty().append(new String(top.buffer(), 0, top.length()));**
        offsetAtt.setOffset(top.startOffset(), top.endOffset());
        posIncrAtt.setPositionIncrement(0);
        return true;
    }

    /*
     * if there are no more incoming tokens return false
     */
    if (!input.incrementToken())
        return false;

    Token wrapper = new Token();
    wrapper.copyBuffer(termAtt.buffer(), 0, termAtt.length());
    wrapper.setStartOffset(offsetAtt.startOffset());
    wrapper.setEndOffset(offsetAtt.endOffset());
    wrapper.setPositionIncrement(posIncrAtt.getPositionIncrement());

    normalizeHyphens(wrapper);
    current = captureState();
    return true;
}

In bolded line above I was saying

termAtt.setEmpty().append(new String(top.buffer()));

When i search for wi, i wasn’t getting any results but wi* used to give results. Looks like this top.buffer() contains some additional junk which was resulting in weird behavior.

wasted a day on this 🙁

  • 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-01T15:52:54+00:00Added an answer on June 1, 2026 at 3:52 pm

    Just guessing without knowing your analyser or parser.

    • Make sure the words wi,fi you are using in your search are not part of the stop words. Probably the stop list file is where you check
    • Faceted search/Weighted search. Make sure you have not messed with these.
    • After parsing/analyzing, make sure you do get the tokenized terms you are searching for.
    • Make sure your terms are pushed into the index.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build

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.