How do I work with hyphens in search queries?

Last updated on April 18, 2024

The Engineering Village search engine normally considers hyphens as insignificant and treats them as spaces in regular search queries.

However, the search engine treats hyphens differently depending upon how they are used in the following search features:

Refer to the following chart for various examples of search queries containing hyphens. This chart contains sample users' search queries, whether Autostemming was enabled or disabled, the corresponding search engine queries, and comments detailing the results returned to the users.

#

User search query

Auto-stemming

Search engine query

Comments

1

((tumor-on-a-chip) WN KY)

OFF

((tumor AND on AND a AND chip) wn KY)

Autostemming OFF, this query with hyphens and without hyphens yield the same result. The hyphens are ignored and treated as spaces.

2

((tumor on a chip) WN KY)

OFF

((tumor AND on AND a AND chip) wn KY)

Autostemming OFF, this query without hyphens and the one with hyphens yield the same result.

3

((tumor-on-a-chip) WN KY)

ON

The following two search queries yield the same results due to Autostemming:

((tumor AND chip) wn KY)

((tumor chip) wn KY)

Autostemming ON, this query stems 'tumor' and 'chip' and finds the singular and plural versions of these words. Additionally, due to the hyphens, the short words 'on' and 'a' are ignored by ElasticSearch.

4

((tumor on a chip) WN KY)

ON

The following two search queries yield the same results due to Autostemming:

((tumor AND on AND a AND chip) wn KY)

((tumors AND on AND a AND chips) wn KY)

Autostemming ON, this query stems 'tumor' and 'chip' and finds the singular and plural versions of these words. However, in this query, all of these 4 words are contained in the Subject/Title/Abstract of this record. Since all 4 words must be contained in the Subject/Title/Abstract of this record, fewer records are in the results than for the same query with the hyphens in which these short words were ignored by ElasticSearch.

5

(("tumor-on-a-chip") WN KY)

OFF

"tumor on a chip" wn KY

This is an exact phrase search, as the search query is enclosed in double quotation marks. In this scenario, the hyphen is treated as a space and all the words in the search phrase must appear in this exact order in the Subject, Title, or Abstract of the record. Additionally, since this is an exact search, Autostemming ON or OFF yields the same results. Therefore, there will be many fewer records that fulfill this search criteria than the search queries without the double quotation marks (either with or without hyphens).

6

(("tumor on a chip") WN KY)

OFF

"tumor on a chip" wn KY

This is an exact phrase search, as the search query is enclosed in double quotation marks. In this scenario, all the words in the search phrase must appear in this exact order in the Subject, Title, or Abstract of the record. Additionally, since this is an exact search, Autostemming ON or OFF yields the same results. Therefore, there will be many fewer records that fulfill this search criteria than the search queries without the double quotation marks (either with or without hyphens).

7

(("tumor-on-a-chip") WN KY)

ON

"tumor on a chip" wn KY

This is an exact phrase search, as the search query is enclosed in double quotation marks. In this scenario, the hyphen is treated as a space and all the words in the search phrase must appear in this exact order in the Subject, Title, or Abstract of the record. Additionally, since this is an exact search, Autostemming ON or OFF yields the same results. Therefore, there will be many fewer records that fulfill this search criteria than the search queries without the double quotation marks (either with or without hyphens).

8

(("tumor on a chip") WN KY)

ON

"tumor on a chip" wn KY

This is an exact phrase search, as the search query is enclosed in double quotation marks. In this scenario, all the words in the search phrase must appear in this exact order in the Subject, Title, or Abstract of the record. Additionally, since this is an exact search, Autostemming ON or OFF yields the same results. Therefore, there will be many fewer records that fulfill this search criteria than the search queries without the double quotation marks (either with or without hyphens).

9

(((tumor-on-a-chip) WN KY))

OFF

((tumor AND on AND a AND chip) wn KY)

Autostemming OFF, this query with hyphens and without hyphens yield the same result.

10

(((tumor on a chip) WN KY))

OFF

((tumor AND on AND a AND chip) wn KY)

Autostemming OFF, this query without hyphens and the one with hyphens yield the same result.

11

(((tumor-on-a-chip) WN KY))

ON

The following two search queries yield the same results due to Autostemming:

((tumor AND chip) wn KY)

((tumor chip) wn KY)

Autostemming ON, this query stems 'tumor' and 'chip' and finds the singular and plural versions of these words. Additionally, due to the hyphens, the short words 'on' and 'a' are ignored by ElasticSearch.

12

(((tumor on a chip) WN KY))

ON

((tumor AND on AND a AND chip) wn KY)

Autostemming ON, this query stems 'tumor' and 'chip' and finds the singular and plural versions of these words. However, in this query, all of these 4 words are contained in the Subject/Title/Abstract of this record. Since all 4 words must be contained in the Subject/Title/Abstract of the records, fewer records are in the results than for the same query with the hyphens in which these short words were ignored by ElasticSearch.

13

((({tumor-on-a-chip}) WN KY))

OFF

"tumor on a chip" wn KY

This is an exact phrase search, as the search query is enclosed in curly braces. In this scenario, the hyphen is treated as a space and all the words in the search phrase must appear in this exact order in the Subject, Title, or Abstract of the record. Additionally, since this is an exact search, Autostemming ON or OFF yields the same results. Therefore, there will be many fewer records that fulfill this search criteria than the search queries without the double quotation marks (either with or without hyphens).

14

((({tumor on a chip}) WN KY))

OFF

{tumor on a chip} wn KY

This is an exact phrase search, as the search query is enclosed in curly braces. In this scenario, all the words in the search phrase must appear in this exact order in the Subject, Title, or Abstract of the record. Additionally, since this is an exact search, Autostemming ON or OFF yields the same results. Therefore, there will be many fewer records that fulfill this search criteria than the search queries without the double quotation marks (either with or without hyphens).

15

((("tumor-on-a-chip") WN KY))

ON

"tumor on a chip" wn KY

This is an exact phrase search, as the search query is enclosed in double quotation marks. In this scenario, the hyphen is treated as a space and all the words in the search phrase must appear in this exact order in the Subject, Title, or Abstract of the record. Additionally, since this is an exact search, Autostemming ON or OFF yields the same results. Therefore, there will be many fewer records that fulfill this search criteria than the search queries without the double quotation marks (either with or without hyphens).

16

((("tumor on a chip") WN KY))

ON

"tumor on a chip" wn KY

This is an exact phrase search, as the search query is enclosed in double quotation marks. In this scenario, all the words in the search phrase must appear in this exact order in the Subject, Title, or Abstract of the record. Additionally, since this is an exact search, Autostemming ON or OFF yields the same results. Therefore, there will be many fewer records that fulfill this search criteria than the search queries without the double quotation marks (either with or without hyphens).

17

((nano-particle*) WN TI)

ON

"nano-particle*" wn TI

In this scenario, a hyphen was used in conjunction with a wildcard. Thus, the hyphen is not ignored and is not treated as a space. In this case, the hyphen is considered to be a part of a phrase query in which the term 'nano' must immediately precede the term 'particle.' Additionally, due to the wildcard/truncation in this query, the results will contain titles with terms that have either the singular or plural form of the term 'particle' in them. Autostemming ON or OFF yield the same results.

18

((nano particle*) WN TI)

ON

nano AND particle* wn TI

In this scenario, there is no hyphen in the search query, and the term 'particle' has a wildcard. Thus, there are many more search results for this query than the previous query above with the hyphen as these terms can appear anywhere in the title. Additionally, due to the wildcard/truncation in this query, the results will contain terms that have either the singular or plural form of the term 'particle' in them. Autostemming ON or OFF yield the same results.

19

(("nano-particles*") WN TI)

ON

"nano particles*" wn TI

Hyphens are ignored and are treated as spaces when used in conjunction with both wildcards and exact search. Due to the use of wildcard/truncation in this exact phrase query for a plural search term, only the plural form of 'particle' is returned in the results. This means that in this scenario, due to the combination of wildcards and exact search, the results will only contain terms in which 'nano' precedes 'particles.' Autostemming ON or OFF yield the same results.

20

(("nano-particle*") WN TI)

ON

"nano particle*" wn TI

Hyphens are ignored and are treated as spaces when used in conjunction with both wildcards and exact search. Due to the use of wildcard/truncation in this exact phrase query for a singular search term, both the singular and plural forms of the term 'particle' are returned in the results. This means that in this scenario, due to the combination of wildcards and exact search, the results will only contain terms in which 'nano' precedes 'particle' or 'particles.' Autostemming ON or OFF yield the same results.

21

({Jones-Smith, K} WN AU)

ON

({Jones-Smith, K} wn AU)

In an exact search query using the Author ('AU') field, hyphens are significant and are not ignored in an exact search query. Autostemming ON or OFF yield the same results for this search query.

22

({Jones Smith, K} WN AU)

ON

({Jones Smith, K} wn AU

This exact search query using the Author ('AU') field yields different search results than the previous search query example which contained hyphens. Autostemming ON or OFF yield the same results for this search query.

23

(smith-*) WN FIRSTAU

OFF

(Smith-*) wn FIRSTAU

This is a regular search query to find authors who have a hyphenated name beginning with 'Smith' in the First Author ('FIRSTAU') field (e.g., 'Smith-Johnson'). Hyphens are significant and are not treated as spaces in this scenario. Autostemming ON or OFF yield the same results for this search query.

24

(*-Smith) WN FIRSTAU

ON

(*-Smith) wn FIRSTAU

This is a regular search query to find authors who have a hyphenated name ending with 'Smith' in the First Author ('FIRSTAU') field (e.g., 'Murray-Smith'). Hyphens are significant and are not treated as spaces in this scenario. Autostemming ON or OFF yield the same results for this search query.

25

({Wright-Patterson AFB} WN AF)

ON

({Wright-Patterson AFB} wn AF)

In an exact search query using the Affiliation ('AF') field, hyphens are significant and are not ignored in an exact search query. Autostemming ON or OFF yield the same results for this search query.

26

({Wright Patterson AFB} WN AF)

ON

({Wright Patterson AFB} wn AF)

This exact search query using the Author ('AU') field yields different search results than the previous search query example which contained hyphens. Autostemming ON or OFF yield the same results for this search query.

Did we answer your question?

Related answers

Recently viewed answers

Functionality disabled due to your cookie preferences

For further assistance: