Category: Solr

Cross Core Query No ratings yet.

After reading so many examples, you may find that all of them are querying against single core collection, how about query with multiple cores like “JOIN” SQL in database? Don’t worry, SOLR supports it. Before the example, let’s create another core right now: Make sure your SOLR is running now, open a command prompt and

Statistics: Count/Min/Max No ratings yet.

If you want to provide some basic statistic figures on your application, such as: Requested URL http://localhost:8983/solr/films/select?q=happy&stats=true&stats.field=directed_by&rows=0&indent=true Details It returns which “directed_by” with max and min appearance of query “happy”. Parameters Values Details q happy Query text stats true Enable statistic function stats.field directed_by Statistic field based on the query text   Please rate this

Faceted Search No ratings yet.

Faceted search is useful to do count(*) feature, please see below examples for your reference: Count(*) by Specified Field When browsing this page : http://localhost:8983/solr/films/browse , you may find Facets field on the left handset as:   With below example, it will return you a list of genres with article counts, so that you can

Spell Check Search – Do you mean? No ratings yet.

When users search, he/she may typo-mistake or spell wrong when entering keyword. You can check out Google search engine, it has a feature like below, asking “Did you mean: something else”, when searching with wrongly spell words like “knigs”.   With SOLR, you can also have this feature. Let’s update the C:/{your_installed_path}/solr-5.4.1/server/solr/films/conf/solrconfig.xml from <str name=”field”>text</str>

Auto-Suggestion (Auto-Complete) Box No ratings yet.

For your application, you may have auto-suggest (or call auto-complete) feature in searching field, such as https://jqueryui.com/autocomplete/#remote .   When user enters two or more than two characters, it will trigger auto-complete action, and remote lookup external web API, which returning list of data in JSON format. So, for example, your application can query SOLR

Basic Search No ratings yet.

Please see the below basic SOLR search examples for your reference: Simple Search Requested URL http://localhost:8983/solr/films/select?q=day&row=20&wt=json&indent=true Parameters Values Details q day Text for searching wt json Return results format, it can be json / xml / python / ruby / php / csv row 20 Optional. By default = 10 Returning no of rows  

Import Data from Database No ratings yet.

Besides indexing the articles through SOLR Update Request-Handler, you can also import data from database. This example will demonstrate how to import data from MySQL database. Assuming you have MySQL installed, let’s run the below simple schema in order to create a database/table with some records: /* create database */ CREATE DATABASE itblogs DEFAULT CHARACTER

What is Dynamic Field? No ratings yet.

If you cannot confirm the fields for your collection initially, or the fields of your data source may change in the future, you can use pre-defined dynamic fields. You can also define some specified for your data source. Let’s check the C:/{your_installed_path}/solr-5.4.1/server/solr/films/conf/managed-schema.xml , you can some pre-defined dynamic fields with tag “<dynamicField>”, such as: <dynamicField

What is Multi-Values Field? No ratings yet.

In the previous blog, we have created a new collection “films”, and it has several multi-values fields such as directed_by, genre and name. Let’s open the C:/{your_installed_path}/solr-5.4.1/server/solr/films/conf/managed-schema.xml to have a look:   However, these fields have not stated ‘multiValued=”true”’, how do you know they aremulti-values? You can check their field type, for example, genre’s field

Setup New Core Collection No ratings yet.

SOLR is up and running now, you may want to setup a new core collection. Creating a new core is similar to “create database” in traditional database. We will use the bundled example “films” to demonstrate how to set it up. Let’s try to create a new one now:   Make sure your SOLR is