project Utilities / File Location Listing avatar

utilities/file_location_listing#41: Result Count Mode



Issue Information

Issue Type: issue
Status: closed
Reported By: btasker
Assigned To: btasker

Milestone: v0.2.5
Created: 10-Jan-24 19:50



Description

I've been using the index to help with a tidy up, as part of that I've been grabbing stats detailing how many results are returned for a given search:

        # Run the search
        res = doSearch(srchterm, SEARCH_URL)
        imgs = doSearch(srchterm, SEARCH_URL, searchtype="IMAGE")

        doc_count = len(res['results']) if res else 0
        img_count = len(imgs['results']) if imgs else 0

This is really quite inefficient - the service has to run the index, load each of the relevant storage files and return it, only for me to chuck the whole lot away once I've counted it. It also means that the process has been slow for certain searches.

What I'd like is for there to be an API endpoint (no need for the searchportal UI to expose it - it's only really of programmatic benefit) which runs the index checks but doesn't load the files unless there's a constraint which requires it.



Toggle State Changes

Activity


assigned to @btasker

It might seem a bit odd to do that work for the sake of one task, but I think there's a reasonable possibility that I'll also use it to implement some monitoring, so it shouldn't turn out to be effort made for the sake of one task.

verified

mentioned in commit 5a19b9f6bc7f763c81ee6feb37de5201c445e49a

Commit: 5a19b9f6bc7f763c81ee6feb37de5201c445e49a 
Author: B Tasker                            
                            
Date: 2024-01-10T20:00:50.000+00:00 

Message

feat: implement ability to run count-only searches (utilities/file_location_listing#41)

+23 -4 (27 lines changed)

Initial implementation:

$ curl -d '{"term":"SD", "type": "DOC", "count-only": true}' http://127.0.0.1:5000/search/
{
  "results": {
    "result_count": 56
  }
}