List of Listings

Chapter 2. Search—under the hood

Listing 2.1. Documents

Listing 2.2. Term dictionary

Listing 2.3. Postings list

Listing 2.4. Text tokenization example

Listing 2.5. Text tokenization example with normalization and filtering

Listing 2.6. Geolocation tokenization using geohashing

Listing 2.7. Boolean AND search

Chapter 3. Debugging your first relevance problem

Listing 3.1. Extract movies from tmdb.json

Listing 3.2. Sample TMDB movie from tmdb.json

Listing 3.3. Indexing with Elasticsearch’s bulk API—reindex

Listing 3.4. Pulling data from TMDB into Elasticsearch

Listing 3.5. The search function

Listing 3.6. Your first search

Listing 3.7. Explaining the behavior of your query

Listing 3.8. Debugging analysis

Listing 3.9. SimpleText index representation for the term fire

Listing 3.10. View of title index with Fire with Fire terms highlighted

Listing 3.11. Reindexing with the English analyzer

Listing 3.12. Requesting a relevancy scoring explanation

Listing 3.13. Simplified explain for Alien

Listing 3.14. Searching with an adjusted boost

Chapter 4. Taming tokens

Listing 4.1. Re-creating the standard analyzer

Listing 4.2. Re-creating the English analyzer in detail

Listing 4.3. Tokenization of query and document text using the English analyzer

Listing 4.4. Building a phonetic analyzer

Listing 4.5. Index configuration for resolving the dress shoes problem

Chapter 5. Basic multifield search

Listing 5.1. Brittle multifield name search

Listing 5.2. Improved multifield name search

Listing 5.3. Extraction, indexing, and search

Listing 5.4. Snippet of Space Jam Elasticsearch document

Listing 5.5. Star Trek query using content from chapter 3

Listing 5.6. Reducing the impact of directors.name

Listing 5.7. Analysis extracting English bigrams

Listing 5.8. Mapping *.bigrammed fields, reindexing

Listing 5.9. Searching *.bigrammed fields

Listing 5.10. Searching for Star Trek Patrick Stewart

Listing 5.11. Down-boosting title

Chapter 6. Term-centric search

Listing 6.1. Indexing “albino elephant” documents

Listing 6.2. Searching for the infamous albino elephant

Listing 6.3. Kirk and Picard visit the planet of albino elephants

Listing 6.4. Snippet of directors.name:william shatner vs. cast.name

Listing 6.5. best_fields suffering from albino elephant

Listing 6.6. Term-by-term dismax gives every search term influence

Listing 6.7. Running a query-parser query

Listing 6.8. Searching fields that work in sync

Listing 6.9. Tuning term-centric search

Listing 6.10. Mapping for custom all field—people

Listing 6.11. Adding copy_to from cast.name to people.name

Listing 6.12. Simple use of a custom all field

Listing 6.13. Searching _all

Listing 6.14. cross_fields search over useful fields

Listing 6.15. Search combining term-centric all field (people.name) with other fields

Listing 6.16. Searching two field groupings—people and text

Listing 6.17. Greedy term-centric paired with highly discriminating like fields

Chapter 7. Shaping the relevance function

Listing 7.1. Base query to boost

Listing 7.2. Boosting with an additional Boolean clause

Listing 7.3. Applying a multiplier for Star Trek movies

Listing 7.4. Filtering instead of boosting Star Trek results

Listing 7.5. Injecting begin/end sentinels for exact matching

Listing 7.6. Isolated testing of your exact-match signal

Listing 7.7. Name and title exact-match fields

Listing 7.8. Boolean boost on exact-title matching

Listing 7.9. Adding a clause for bigrammed matches (base query not shown)

Listing 7.10. Factoring in user’s ratings of the movies

Listing 7.11. Gaussian decay from the user’s recency goal

Listing 7.12. Clause for exact-name matching, ranking based on recency and user rating

Chapter 8. Providing relevance feedback

Listing 8.1. Analysis setup for 2-gram completions

Listing 8.2. Mappings for title-based completions

Listing 8.3. Query used to generate completions

Listing 8.4. Example response for aggregation-based search completion

Listing 8.5. Setting up Elasticsearch’s completion suggester

Listing 8.6. Enriching documents with a completion field using popularity for weight

Listing 8.7. Retrieving search completions via the _suggest endpoint

Listing 8.8. Retrieving post-search suggestions in the context of a user’s search

Listing 8.9. Search and suggestion results after collations have been applied

Listing 8.10. Facet counts for movie genres

Listing 8.11. Submitting a query with highlighting enabled

Listing 8.12. Partial response for a search for “Star Trek” with highlighting enabled

Listing 8.13. Using a combination of terms and top hits aggregation for doc grouping

Listing 8.14. Documents grouped with a combination of terms and top hits aggregation

Listing 8.15. Sorting groups according to the most relevant document in the group

Chapter 9. Designing a relevance-focused search application

Listing 9.1. Bounding-box geographic filter

Listing 9.2. Geo-query scoring restaurants near to the user more highly

Listing 9.3. Query associated with content

Listing 9.4. User-preference filter to limit to matches according to price or rating

Listing 9.5. Business concerns query to promote paying and engaged customers

Listing 9.6. Composite query that incorporates all of the major signals

Listing 9.7. Equation representing the calculation of the overall score

Chapter 11. Semantic and personalized search

Listing 11.1. Base query

Listing 11.2. A multiplicative boost can be used to incorporate collaborative filtering

Listing 11.3. Simple documents illustrating term co-occurrence

Appendix A. Indexing directly from TMDB

Listing A.1. How boilerplate is done

Listing A.2. Crawling movies from TMDB—movieList

Listing A.3. Extracting each movie from TMDB—extract

Listing A.4. Get cast and crew

Listing A.5. reindex function

Listing A.6. Index to Elasticsearch

Listing A.7. Create tmdb.json

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.49.190