ansys / pyfluent

Pythonic interface to Ansys Fluent
https://fluent.docs.pyansys.com
MIT License
270 stars 40 forks source link

Search module improvements #3385

Open mkundu1 opened 3 days ago

mkundu1 commented 3 days ago

Couple of proposed improvements for the search module from the chat:

Using the pyfluent.search function, how to search for exact settings API child names solver or settings? pyfluent.search("solver", match_whole_word=True) includes everything probably because it considers the prefix. pyfluent.search("settings", match_whole_word=True) includes results like .setup.models.discrete_phase.general_settings (Object)

I think the current behaviour for match_wholeword, where it splits by , is okay. We probably need a new control for a more api-focused search.

A search for "X" with match_whole_word=True means we match each node named "X", not each node that has "X" in its parent hierarchy. I haven't tested this or looked at the tests since Mainak's message so I don't know if I might be misinterpreting the issue. We should start by updating the tests to make sure that we are asserting all the required, correct behaviour. Then we can update the code to match with that.

mkundu1 commented 3 days ago

We should put an updated design first before making any code change.

Please also consider consolidating the duplicate data api_tree_251.pickle between api_tree/api_objects.json. This will reduce out package size. The legacy _search function can be removed if needed.

hpohekar commented 1 minute ago

@seanpearsonuk @mkundu1

We can not remove _search function for following reasons.

  1. We do not support search_root feature in search.
  2. If we support search_root in search then we get circular import error therefore as per our last discussion we have kept it separate in _search only to be able to use it in flobject.py.

We have kept api_tree_251.pickle file as it is needed for _search. To improve search performance we have added api_tree/api_objects.json. I think we can have a single file to avoid duplication. Let's see.