Sie sind auf Seite 1von 4

** start solr

cd $SOLR_INSTALL/realestate
java -jar start.jar
** cleaning up index :
remove the collection1/data/*
** Solr is a document storage and retrieval engine. Every piece of data submitte
d to
Solr for processing is a document. A document could be a newspaper article, a re
sume
or social profile, or, in an extreme case, an entire book.
Terms, phrases, and Boolean logic
==================================
AND -> wrox AND java
jquery wrox AND java ===> jquery OR (wrox AND java)
jquery (wrox AND java)
**/select/?q=wrox java&q.op=OR versus /select?q=wrox java&q.op=AND
Phrease : "wrox java" ==> one doc will return
(name:"Red Lobster" -state:California )AND price:[25 TO *]
**/select/?q=new house&q.op=OR versus /select?q=new house&q.op=AND
Fuzzy matching -> inexact matches
==================================
someone may want to search for any words that start with a particular prefix (kn
own as wildcard searching),
may want to find spelling variations within one or two characters (known as fuzz
y searching or edit distance searching),
may want to match two terms within some maximum distance of each other (known as
proximity searching).
WILDCARD SEARCHING
====================
Query:
Query:
Query:
Query:

office OR officer OR official OR officiate OR


offi* Matches office, officer, official, and so on
off*r Matches offer, officer, officiator, and so on
off?r Matches offer, but not officer

**Leading wildcards :
engineer* will not be expensive
e* will be expensive
wildcard searching is that wildcards are only meant to work on individual search
terms, not on phrase searches
Works: softwar* eng?neering
Does not work: "softwar* eng?neering"
**FUZZY / EDIT - DISTANCE SEARCHING
===================================

An edit distance is defined as an insertion, a deletion, a substitution, or a tr


ansposition of characters.
Query: administrator~ Matches:
adminstrator,
administrater,
administratior, and
so forth
Query: administrator~1 Matches within one edit distance.
Query: administrator~2 Matches within two edit distances. (This is the default i
f no edit distance is provided.)
Query: administrator~N Matches within N edit distances.
Please note that any edit distances requested above two will become increasingly
slower and will be more likely to match unexpected terms.
**PROXIMITY SEARCHING
=====================
Query: "chief executive officer" OR "chief financial officer" OR "chief marketin
g officer" OR "chief technology officer" OR ...
Query : "chief officer"~1
Meaning : chief and officer must be a maximum of one position away.
Examples : "chief executive officer" , "chief financial officer"
Query: "chief officer"~2
Meaning: chief and officer must be a maximum of two edit distances away.
Examples: "chief business development officer" , "officer chief"
Query: "chief officer"~N
Meaning: Finds chief within N positions of officer .
***RANGE SEARCHING
==================
February 2, 2012, and August 2, 2012
Query: created:[2012-02-01T00:00.0Z TO 2012-08-02T00:00.0Z]
Query: yearsOld:[18 TO 21] Matches 18, 19, 20, 21
Query: title:[boat TO boulder] Matches boat, boil, book, boulder, etc.
Query: price:[12.99 TO 14.99] Matches 12.99, 13.000009, 14.99, etc.
Query: yearsOld:{18 TO 21} Matches 19 and 20 but not 18 or 21
Query: yearsOld:[18 TO 21} Matches 18, 19, 20, but not 21
Query: yearsOld:[* TO 21}
***RETURNING DYNAMIC VALUES
===========================
In addition to the stored fields in your documents, one of the most useful piece
s of
information to know about each document isthe relevancy score.
/select?...&fl=*,score
/select?...&fl=id,sum(integerField,10)
***RETURN FIELD ALIASES
/select?...&fl=id,betterFieldName:actualFieldName

*** PAGING
==========
Query 1
/select?q=*:*&sort=id&fl=id&
rows=5&
start=0
: will return 1 to 5
Query 2
/select?q=*:*&sort=id&fl=id&
rows=5&
start=5
:will return 6 to 10
*** Sorting results
===================
sort=someField desc, someOtherField asc
sort=score desc, date desc
sort=date desc, popularity desc, score desc
*Any field you wish to sort on must be marked as indexed=true

******************** FACET
Field faceting
===============
http://localhost:8983/solr/select?
q=*:*&echoParams=none&rows=0&facet=true&facet.field=name
http://localhost:8983/solr/select?
q=*:*&facet=true&facet.field=tags
Query faceting
==============
1. http://localhost:8983/solr/select?q=*:*&fq=price:[5 TO 25]
2. http://localhost:8983/solr/select?q=*:*&fq=price:[5 TO 25]&
fq=state:("New York" OR "Georgia" OR "South Carolina")
http://localhost:8983/solr/select?q=*:*&rows=0&facet=true&facet.query=price:[* T
O 5}&facet.query=price:[5 TO 10}&facet.query=price:[10 TO 20}&facet.query=price:
[20 TO 50}&facet.query=price:[50 TO *]
Range faceting
===============
http://localhost:8983/solr/select?q=*:*&facet=true&facet.range=price&facet.range
.start=0&facet.range.end=50&facet.range.gap=5
Applying filters to your facets
===============================
without filter
http://localhost:8983/solr/select?q=*:*&facet=true&facet.field=state&facet.field
=city&facet.query=price:[* TO 10}&facet.query=price:[10 TO 25}&facet.query=price
:[25 TO 50}&facet.query=price:[50 TO *]
with filer
http://localhost:8983/solr/select?q=*:*&facet=true&facet.mincount=1&facet.field=

state&facet.field=city&facet.query=price:[* TO 10}&facet.query=price:[10 TO 25}&


facet.query=price:[25 TO 50}&facet.query=price:[50 TO *]&fq=state:California
NO FILTERS APPLIED
Query
http://localhost:8983/solr/select?q=*:*&facet=true&facet.mincount=1&facet.field=
name&facet.field=tags
ONE FILTER APPLIED
Query
http://localhost:8983/solr/select?q=*:*&facet=true&facet.mincount=1&facet.field=
name&facet.field=tags&fq=tags:coffee
TWO FILTERS APPLIED
Query
http://localhost:8983/solr/select?q=*:*&facet=true&facet.mincount=1&facet.field=
name&facet.field=tags&fq=tags:coffee&fq=tags:hamburgers

Das könnte Ihnen auch gefallen