[null,null,["อัปเดตล่าสุด 2025-08-29 UTC"],[],[],null,["# Compensate for default expansions, interpretations, and optimizations\n\nGoogle Cloud Search has several default expansions, interpretations, and\noptimizations that affect search results. If ever you are seeing unexpected\nresults from search queries, refer to this guide before contacting Cloud Search\nsupport.\n| **Note:** The example queries in this document are shown in square brackets to set them apart from words specified in quotes representing Google's interpretation of the query.\n| **Note:** The query results in this document don't represent guarantees of product behavior. Instead, the results shown in this document provide insight of how expansions, interpretations, and optimizations work.\n\nDefault expansions\n------------------\n\nSuppose a user is searching using a string, such as \\[Joe's PDFs\\], but\nsome returned results contain highlighted words, such as \"documents,\" instead of\n\"PDFs.\" Why do the results contain the highlighted words that weren't in the\nsearch query?\n\nBy default, Google Cloud Search, just like Google Web Search, doesn't only\nsearch for the exact words in a query. Instead Cloud Search expands the query\nto include synonyms and word stems (even if you haven't implemented your own\nsynonyms). This expansion is done to retrieve documents that broadly match the\nidea and intent of the query. After this broad set of documents is selected, the\nranking algorithms work to ensure that the best matches are placed at the top of\nthe result set.\n\nWhen the user searched for \\[Joe's PDFs\\], Cloud Search supplied the following as\nadditional acceptable words:\n\n- For \\[Joe's\\], Cloud Search might also match \"joe\" (a stem expansion) and \"joes\" (a synonym based on punctuation).\n- For \\[PDFs\\], Cloud Search might also match \"documents\" (a synonym expansion) and \"pdf\" (a stem expansion).\n\nBy default, synonyms are not necessarily bi-directional. For example, if a user\nsearches for the term \"phishing,\" Cloud Search might match \"phish\" as a synonym\nexpansion. However if the user searches for the term \"phish,\" Google might not\nmatch \"phishing\" as an expansion.\n\n### Expansions for hyphenated versus non-hyphenated words\n\nWhen the user searches for hyphenated words versus their non-hyphenated\nequivalents, such as \\[walk-in closet\\] and \\[walk in closet\\], Cloud Search\ntreats these queries differently.\n\nAdditionally, different optimizations are used for hyphenated and underscored\nwords, such as \\[walk-in\\] and \\[walk_in\\].\n\n### Compensate for default expansions\n\nThere is no guarantee of any expansion by default. If you want to\nensure bidirectionality of synonyms or domain-specific synonym expansions,\ncreate your own set of domain-specific synonyms. For further information on\nimplementing synonyms, refer to\n[Define synonyms](/workspace/cloud-search/docs/guides/synonyms).\n| **Note:** It is important to educate your users on the use of quotes for exact matching, either as options in your search interface or in your documentation. For example, instead of searching for \\[Joe's PDFs\\], search for \\[Joe's \"PDFs\"\\], where \"PDFs\" is in quotes, to return documents that exactly match the word \"PDFs.\"\n\nDefault interpretations\n-----------------------\n\nCloud Search also provides natural-language interpretation which\ninterprets the objects, properties, and field values used in a query according\nto the schema uploaded for a particular data source. For further information\nabout this natural-language interpretation, refer to\n[Structure your schema for optimal query interpretation](/workspace/cloud-search/docs/guides/query-interpretation).\n\n### Disable natural-language interpretations\n\nTo disable natural-language interpretations for a specific query, set\n[`QueryInterpretationOptions.disableNlInterpretation`](/workspace/cloud-search/docs/reference/rest/v1/query/search#queryinterpretationoptions)\nto `true` in the search request.\n\nDefault optimizations\n---------------------\n\nCloud Search provides these default optimizations as well:\n\n- Blending in results provided by spelling correction. For example, if the query\n string was \\[corpoate benefits\\], Cloud Search would match \"corpoate\" and the\n correct spelling of \"corporate.\"\n\n | **Note:** When a user incorrectly spells a word in a query, the query's response might contain a suggested spelling in the [`SpellResult`](/workspace/cloud-search/docs/reference/rest/v1/query/search#spellresult) field. Although the systems providing spelling and synonyms results are separate, the synonyms system might provide a correct spelling as a synonym for an incorrect spelling. For example, the user searches for \\[procss\\] and receives \"process\" as a synonym. The `SpellResult` field is only populated in the case of an actual spell correction.\n- For queries that would yield zero or few results, Cloud Search uses a more\n permissive set of related terms, broader than direct synonyms, when matching\n results. For further information, refer to\n [Handle supplemental results](/workspace/cloud-search/docs/guides/query-guide#display_query_results).\n\nNormalizing documents and queries\n---------------------------------\n\nNormalizing refers to standardizing on certain words or phrases either prior to\nor after a query has been made. To ensure more consistent responses to your\nqueries, consider normalizing your documents (prior to or during indexing) and\nqueries (after the user has made the query) in the following ways:\n\n- To normalize documents:\n\n 1. Pick a canonical spelling for critical words used in documents within your repositories.\n 2. Correct the spelling in source repository documents, or when indexing content, to match canonical spelling.\n- To normalize queries:\n\n 1. Intercept user queries before sending them to Cloud Search.\n 2. Rewrite words in user queries to match the most-common spelling in the indexed data source.\n 3. Send the query to Cloud Search.\n\nDisable expansions, interpretations, and optimizations for all queries\n----------------------------------------------------------------------\n\nTo disable expansions, interpretations and optimizations for a specific query,\nset\n[`QueryInterpretationOptions.enableVerbatim Mode`](/workspace/cloud-search/docs/reference/rest/v1/query/search#queryinterpretationoptions)\nto `true` in the search request."]]