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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:29:06+00:00 2026-06-04T23:29:06+00:00

I am using Apache Solr, Say I search for B I want Solr to

  • 0

I am using Apache Solr, Say I search for “B” I want Solr to return “AB”,”BA”,”ABA”

    SolrQuery query = new SolrQuery();
    query.setQuery("*:*");
    query.addFilterQuery("color:*B*");

However, it is throwing an exception, what should I do?

Caused by: org.apache.lucene.queryParser.ParseException: Cannot parse 'color:*B*': '*' or '?' not allowed as first character in WildcardQuery
    at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:211)
    at org.apache.solr.search.LuceneQParser.parse(LuceneQParserPlugin.java:80)
    at org.apache.solr.search.QParser.getQuery(QParser.java:142)
    at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:114)
    ... 17 more
Caused by: org.apache.lucene.queryParser.ParseException: '*' or '?' not allowed as first character in WildcardQuery
  • 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-04T23:29:07+00:00Added an answer on June 4, 2026 at 11:29 pm

    When you say AB or ABA or BA, these are one single units or one word each. When you index them they are stored in the inverted index as is i.e ABA or BA etc. When you search for B in the inverted index it is not found. What you need to do is mark your fields as n-gram indexed (instead of type=”text” or type=”string” in your schema.xml mark them as type=”NGram”) which would index partial words too on top of full words. Once you are done with your N-Gram Indexing and then when you search for B you would get all of AB or BA or ABA. But remember that N-Gram indexing is space/time intensive.

    For an example, say your field name is color, then in your schema.xml :

    <field name="color" type="nGram" indexed="true" stored="true" required="false" />
    

    Also check whether this portion of XML is present in your schema.xml (if not, the copy paste this):

    <fieldType name="nGram" class="solr.TextField"
    positionIncrementGap="100" stored="false" multiValued="true">
    <analyzer type="index">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <!-- potentially word delimiter, synonym filter, stop words,
    NOT stemming -->
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.NGramFilterFactory" minGramSize="1"
    maxGramSize="15"/>
    </analyzer>
    <analyzer type="query">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <!-- potentially word delimiter, synonym filter, stop words,
    NOT stemming -->
    <filter class="solr.LowerCaseFilterFactory"/>
    </analyzer>
    </fieldType>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried search using Apache SOLR. I have done with the PHP client
I am using apache solr search integration on my Drupal 6 website: govoluntourism.com .
I am using Apache Solr for search. I use this to provide personal user-based
I'm trying to create a custom search interface for Apache Solr using Drupal ,
I'm using drupal 7, with apache solr... I want to print a content field
I am using Apache Solr for my search , using this i am indexing
I'm considering using apache solr as the search backbone on my site. Along with
Currently using solrServer = new CommonsHttpSolrServer(serverUrl); and with these jars.. apache-solr-core-3.6.0 apache-solr-solrj-3.6.0 commons-codec-1.6 commons-httpclient-3.1
I'm using Apache Commons Logging and SLF4J with log4j, but I also want to
I am working on Solr in my application. I am using apache-solr-solrj-1.4.0.jar . When

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.