Why doesn't Solr query work on spaces?


Aswin Raghavan

I'm a beginner in Solr and have the following set of indexes in my Soleserver:

{
        "id": "book5",
              "title": [
          "Five point someone"
        ],
        "author": "Chetan Bagat",
        "genere": "fantasy",
        "description": [
          "An iit guide"
        ],
        "comments": [
          "good",
          "excellent"
        ],
        "publications": [
          "swapnapublications",
          "pb publications"
        ]
      } 

and

{
        "id": "book1",
        "title": [
          "nightatcallcenter"
        ],
        "author": "ChetanBagat",
        "genere": "fiction",
        "description": [
          "Aniitguide"
        ],
        "comments": [
          "good",
          "excellent"
        ],
        "publications": [
          "bangalorepublications",
          "aswinpublications"
        ]
      }

my query q = five + points + someone failed

but my query

q = nightatcallcenter stays in good shape, why is this happening? How do I make the first query work

My schema:

 <fields>
        <field name="id" type="text_general" indexed="true" stored="true" required="true" multiValued="false" />
        <field name="title" type="text_general" indexed="true" stored="true" multiValued="true"/ 
            <field name="genere" type="text_general" indexed="true" stored="true"/>
            <field name="description" type="text_general" indexed="true" stored="true" multiValued="true"/>
            <field name="comments" type="text_general" indexed="true" stored="true" multiValued="true"/>
            <field name="author" type="text_general" indexed="true" stored="true" />
            <field name="publications" type="text_general" indexed="true" stored="true" multiValued="true" />
            <copyField  source='*' dest='fulltext'/>
            <field name='fulltext' type='text_general' multiValued='true '/>
 </fields>
Alex

The problem you are having is using text_general, you are creating a token. When searching Five +point+someone, you are looking for three markers:

  1. Fives
  2. View
  3. someone

A clean solution you can use is to create a custom code text_generallike this:

<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
  <analyzer type="index">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
    <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
</fieldType>

Related


Why doesn't Solr query work on spaces?

Aswin Raghavan I'm a beginner in Solr and have the following set of indexes in my Soleserver: { "id": "book5", "title": [ "Five point someone" ], "author": "Chetan Bagat", "genere": "fantasy", "de

Why doesn't Solr query work on spaces?

Aswin Raghavan I'm a beginner in Solr and have the following set of indexes in my Soleserver: { "id": "book5", "title": [ "Five point someone" ], "author": "Chetan Bagat", "genere": "fantasy", "de

Solr Facet tag exclusion doesn't work with spaces

Akshay I'm using exclude and mark for faceting. Oddly, it works where I have no value. http://192.168.2.114:8983/solr/customer/select?indent=on&q=*:*&fq=(%7B!tag%3DstateName%7DstateName:%22Gujarat%22)&fq=(%7B!tag%3DstateName%7DstateName:%22AndhraPradesh%22)&fa

Why doesn't it work if I add spaces in it?

Mixin So I'm creating a theme for a blogging platform, and I only have template editing access to this template (meaning I can't control what comes from the server). I want to remove duplicates, I want to remove duplicate images from blog post page. this is th

Why doesn't it work if I add spaces in it?

Mixin So I'm creating a theme for a blogging platform, and I only have template editing access to this template (meaning I can't control what comes from the server). I want to remove duplicates, I want to remove duplicate images from blog post page. this is th

why this query doesn't work

Nicoletta Sotiri I'm new to SQL so I don't understand why this query doesn't work. Thank you in advance CREATE VIEW temp AS SELECT return_date_time, renting_date_time FROM renting; CREATE TRIGGER charge_calc AFTER UPDATE ON renting.return_date_time FOR EACH R

Why doesn't this query work?

username Why does the following query not work in SQL Server 2008? SELECT CONVERT(INT, TEMP.observ_value) AS value FROM (SELECT observ_value FROM LAB_RESULTS WHERE observ_value NOT LIKE '%[^0-9]%') TEMP WHERE observ_value >= 190 Her

Why doesn't this query work?

username Why does the following query not work in SQL Server 2008? SELECT CONVERT(INT, TEMP.observ_value) AS value FROM (SELECT observ_value FROM LAB_RESULTS WHERE observ_value NOT LIKE '%[^0-9]%') TEMP WHERE observ_value >= 190 Her

Why FireStore where query doesn't work?

TSR FireStore whereis not working, or I am doing something wrong. I am trying to email the user:[email protected] Here is the code: const admin = require('firebase-admin'); var serviceAccount = require('../secret/nicecode-e3e53-2ddaa9d588ea.json'); admin.ini

Why graphql query doesn't work in react?

Andre Mello In my React project, I use query to search github user data. The query is as follows: const GET_USER = (user) => ` { user(login: "${user}") { name login avatarUrl company gists{ totalCount } following{ totalCo

Why doesn't this query work for the specified date?

User 7475343 I have connected my database using php. When I press the delete button, a php file is connected to another php file with the following code: <?php include("dbconfig.php"); $memberID = $_GET['memberID']; $ISBN = $_GET['ISBN']; $copyNr = $_GET['c

Why doesn't PDO query work on the server?

Dojo development I just uploaded my local project to the server, but PDO query doesn't work in LIVE server. It works fine locally. I thought maybe PDO wasn't installed on the server, so I ran the script below The PHP version in the server is PHP Version 5.3.3,

Why query update doesn't work at all

Andy So I've been trying to change my code to any other suitable way but nothing happens...I want to change status_data_userfrom active to inactive but it doesn't work...in my The other delete code works without any problem. I keep changing it to $hapus = mysq

Why graphql query doesn't work in react?

Andre Mello In my React project, I use query to search github user data. The query is as follows: const GET_USER = (user) => ` { user(login: "${user}") { name login avatarUrl company gists{ totalCount } following{ totalCo

Why FireStore where query doesn't work?

TSR FireStore whereis not working, or I am doing something wrong. I am trying to email the user:[email protected] Here is the code: const admin = require('firebase-admin'); var serviceAccount = require('../secret/nicecode-e3e53-2ddaa9d588ea.json'); admin.ini

Why doesn't this query work for the specified date?

User 7475343 I have connected my database using php. When I press the delete button, a php file is connected to another php file with the following code: <?php include("dbconfig.php"); $memberID = $_GET['memberID']; $ISBN = $_GET['ISBN']; $copyNr = $_GET['c

Why doesn't '=' work in this SQL query?

Jack Lu I have a query against a sakila database in MySQL 8 (you can easily setup one from https://hub.docker.com/r/1maa/sakila ). select * from store _0 where ( select address_id from ( select * from address _3 where ( address_id = (

Why doesn't '=' work in this SQL query?

Jack Lu I have a query against a sakila database in MySQL 8 (you can easily setup one from https://hub.docker.com/r/1maa/sakila ). select * from store _0 where ( select address_id from ( select * from address _3 where ( address_id = (

Why query update doesn't work at all

Andy So I've been trying to change my code to any other suitable way but nothing happens...I want to change status_data_userfrom active to inactive but it doesn't work...in my The other delete code works without any problem. I keep changing it to $hapus = mysq

Why doesn't this group by query work?

Joseph My query is not grouping correctly and returning wrong results, I can't figure out what the problem is. The query is as follows. FYI - the current form is unclear, the reason I need group by is because I removed all other parts of the query to find the

Why doesn't my query work with RDFlib

Marcelo I've been trying to query OWL data using RDFlib (SPARQL), but I don't understand why it doesn't work. I tested the same query (SPARQL query) in Protege and it worked great! Here is my code: import rdflib from rdflib import plugin from rdflib.graph impo

Why doesn't this GROUP BY query work?

thin tube I am using the following query to query an Access table: SELECT (VIN&' '&Make&' '&Model&' '&CarYear&' '&ExColor&' '&InColor&' ')as CarDescript FROM TestTable WHERE (WorkOrderNumber='$workorder') GROUP BY AssignedEmp; But simi

Why doesn't this SQL query work in Python?

Bisla I have a function findParentthat takes a string, compares it to other strings, dband returns another string. I write this in a .py file. products=db(findParent(db.product_info.source_place)==auth.user.place).select() The problem is that db.product_info.

Why the query doesn't work if the value is blank

Silicon 8 I have a query executed in my C# code: protected void btnSearch_Click(object sender, EventArgs e) { Conn = new SqlConnection(cString); Conn.Open(); theGender = slcGender.SelectedItem.Text; if (slcLocation.SelectedIte

Why doesn't the ALL keyword work in this query?

Chihiz Sharma I have the following SQL query: SELECT name FROM world WHERE gdp > ALL (SELECT gdp FROM world WHERE continent = 'Europe') I am running this query on sqlzoo to find countries with a higher GDP than every country in Europe. The expec

Why doesn't this DELETE query work?

Dizziness 49 I don't know why this query doesn't work. I did a SELECT to confirm that it was pulling the rows I wanted. I typed DELETE and it won't work now. Here is my SELECT query: SELECT dh.dragon_list_id, dh.habitat_list_id FROM dragon_to_habitat dh, drag

Why this (group) MySQL query doesn't work

Ilan Kleiman I have this MySQL query but can't seem to solve it. I want it to group the "symbols" in the table "portfolio". ( SELECT symbol FROM portfolio GROUP BY symbol) though, I would like it to limit its search to: ( WHERE key = '$key' AND hash = '$hash'