This applies to the Google API for situations where there are many (thousands of) hits in Web text searches.
When searching large text sources, typically books, the default display order of results of well used search terms A and B may list the hits with A and B close together in the text block, first.
But not always.
The engine employs other factors such as popularity, date of text, text size, scan date, meta info, and so on, so the output can appear "random", and a few of the A_close_to_B hits get shunted way down in the search results.

The purpose of this question is to address concerns the agents of search have, by way of intuition, the notion that (the first) two search arguments (A, B) are most likely to appear in the same sentence, or paragraph, of the target text block. Thus, can the search results pages show the "closest" arguments (A, B) on page 1, and successive results pages show hits according to the criteria of increasing argument (A, B) distance?

Text Block____________
Text Block____________
Text Block____________|
Text Block_A__|_______|
Text Block____m______|
Text Block____|_______|
Text Block_B__|_______|
Text Block____________|
Text Block____________M (scalar)
Text Block____________
Text Block____________

More specifically, well-used search terms (can be a quoted phrase) A and B are desired as being scalar value m (less than M) characters away from each other in the text block. The smallest (nearest) of the m < M hits would be displayed in the list first, succeeded by others as m approaches M. Whether or not any results are displayed when m > M, may be considered as optional in the Advanced Search section.

All well and good, as a solution to the above scenario addresses a most of the above issues identified with ordered search results.

Introduce another term C, which can either be set as within M of A or B or both/neither. At greater cost to GUI and engine, also consider a new limit K of A and N of B.
When more search arguments D, E, ... etc. get added to the mix, it is more of a challenge to conceptualize the search page GUI with implementation of such an integration, especially when different relational limits K, N, O, ... etc. are on offer.

So applying just the one limit M to all terms will conceivably be part of the most practical solution.
The question points to the possibility of tailoring the API for this purpose- if not- it's out there for perhaps a development for even Google itself to consider, as Chrome evolves.

  • If you're commited enough to this question to put half your rep down on it how about editing it to make it clear? I've ready it twice and still can't see what you're asking. All your doing is describing things. – candied_orange Dec 3 '18 at 4:41
  • @candied_orange: Added more to the italicised section. Is that enough? – Laurie Stearn Dec 3 '18 at 8:39
  • No. I still have no idea what your asking. Concerns of "agents of search" isn't a question. Saying what happens because of search arguments isn't a question. What the heck are you asking? – candied_orange Dec 3 '18 at 8:45
  • You use Google Search. You are an agent of Search. I use Google Search. I am an agent of Search. Quote: "the search results pages will show the "closest" arguments (A, B) on page 1, and successive results pages will show hits according to the criteria of increasing argument (A, B) distance." Closest arguments first, not on the 50,000th result page. Can't explain it any other way, sorry. – Laurie Stearn Dec 3 '18 at 9:15
  • 1
    try adding a question mark somewhere in there please – Ewan Dec 3 '18 at 9:16

OK I'm giving this a shot.

Your question seems to boil down to:

"How could you write a search engine which puts emphasis on results where search terms appear close together in searched documents"

And you note the obvious problem that with multiple search terms it becomes non trivial to define whether

A x x B x x x x x x x x x x C x x D

is better than

A x B x C x x x x x x x x x x x x D

But this really isn't an issue with how to program a search engine, it's really the problem of "What do humans consider a 'good match' to be?"

When considering this question we can quickly see that a simple measure like closeness of words doesn't really help us much eg.

If I search for "Microsoft Share Price", I would definitely want to see a page with the title "Share Prices" and "Microsoft" way down at the end of an alphabetical list over "How to Share Documents in Microsoft Word, Price £10.99"

We should also move away from aspects relating to Google or other search engine companies. Who might well consider "Which matches earn us the most money?" as more important when evaluating the match.

So in conclusion. No there isn't a way to search google and order the results based on your criteria, nor should we expect to be offered one unless we are paying for a bespoke product.

  • Thanks for the time invested in this reply. In my case, searching through old Latin OCR'd texts for certain phrases, the bespoke is mandatory. But not on offer AFAIK through Google books, unfortunately. – Laurie Stearn Dec 3 '18 at 10:56
  • Have you thought of phrasing your question to google as "When I Search Google Books for latin phrases the closeness of the words is super important. please can you add a feature to prioritise these results?" – Ewan Dec 3 '18 at 11:00
  • No, because there are other languages besides English where it's used. And in researching quotations in English it's also useful, as the original renditions of the quotation or proverb change throughout the intervening ages. – Laurie Stearn Dec 3 '18 at 11:10
  • Another good way of getting your questions answered is to upvote good answers. #justsayin – Ewan Dec 3 '18 at 11:14

The Google engine clearly does not offer such functionality at this time, as it has been assumed most agents do not require it. To illustrate, we can provide "near matches" found in their docs:

  • RestrictRange: This applies only to dates, unfortunately. Why not RestrictRange (A, B) where A is A chars before the query argument, and B is B chars after the query argument?
  • Cloud: BG_Query: This links to the command line reference, where --min_completion_ratio has promise, but the minimum_fraction_of_data is presumed as calculated from the beginning of the data block.
  • Google Books Query Fields: Possibly a subset of this bunch of available fields taken from one of the Google Docs popups. Again, nothing stands out as a candidate.

If only Google could integrate regex into their search engine a little more: e.g. with Java, something like intindexOf and intlastindexOf.

  • @Downvoter: They do? Tell us more! Downvoting only tells us something about you. – Laurie Stearn Dec 12 '18 at 6:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.