Skip to content

Add other highlight options #131

@cgelino

Description

@cgelino

The current ADS API allows for additional option related to the highlighting of search terms, but these options are not passable through SearchQuery. I've added the API parameters "hl.snippets" and "hl.maxAnalyzedChars" to my own version of search.py. Would it be possible to include that in this distribution?

The things I changed in the definition of SearchQuery were

def __init__(self, query_dict=None, q=None, fq=None, fl=DEFAULT_FIELDS,
             sort=None, cursorMark=None, start=None, rows=50, max_pages=1,
             token=None, hl=None, hl_snippets=2, hl_maxAnalyzedChars=51200, **kwargs):

and

        _ = {
            "q": q or '',
            "fq": fq,
            "fl": fl,
            "hl": hl,
            "hl.fl": hl_fl,
            "hl.snippets": hl_snippets,
            "hl.maxAnalyzedChars": hl_maxAnalyzedChars,
            "sort": sort,
            "start": start,
            "cursorMark": cursorMark,
            "rows": int(rows),
        }

It should be just as easy to add the option of "hl.fragsize". I didn't do that because I had no need for it for my work.
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions