Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: search module improvements #3497

Merged
merged 26 commits into from
Nov 21, 2024
Merged

Conversation

hpohekar
Copy link
Collaborator

@hpohekar hpohekar commented Nov 19, 2024

closes #3496, #3498, #3499

Improve synset handling

  1. Removed empty synset lists.
  2. Removed duplicate values from synset list.
  3. Store synset names.

Remove duplicate data and dependency on api_tree_version.pickle file

  1. Removed need of the api_tree_<version>.pickle file.

Refactor flobject.py for search function

  1. Refactored _search.
  2. Added module level variable to return or print results as per the requirement.
  3. Refactored flobject.py
  4. Refactored test_search.py and removed tests related to legacy search function.
  5. Refactored settings_extrenal.py

Reorder search function

  1. Changed the order of search based on the arguments preferences

Add more tests

  1. Added test from test: Example of unittests for search-related functions #3393

@hpohekar hpohekar linked an issue Nov 19, 2024 that may be closed by this pull request
tests/test_search.py Outdated Show resolved Hide resolved
@hpohekar hpohekar linked an issue Nov 20, 2024 that may be closed by this pull request
@hpohekar hpohekar linked an issue Nov 20, 2024 that may be closed by this pull request
@hpohekar hpohekar linked an issue Nov 20, 2024 that may be closed by this pull request
@mkundu1
Copy link
Contributor

mkundu1 commented Nov 20, 2024

@hpohekar We don't support search_root in the new search function. Feel free to clean up the function _get_version_path_prefix_from_obj and relevant tests (in same or different PR).

@mkundu1
Copy link
Contributor

mkundu1 commented Nov 20, 2024

@hpohekar we'll check if any change in required for PyConsole after merging this PR

@mkundu1
Copy link
Contributor

mkundu1 commented Nov 20, 2024

@hpohekar Can you please add this test?

api_tree_data = {
    "api_objects": [
        "<solver_session>.first_last (Object)",
        "<solver_session>.none (Object)",
    ],
    ...
}
assert pyfluent.search("first", match_whole_word=True) == ["<solver_session>.first_last (Object)"]
assert pyfluent.search("last", match_whole_word=True) == ["<solver_session>.first_last (Object)"]
# It is OK if we don't support the following - the above 2 are more important
assert pyfluent.search("first_last", match_whole_word=True) == ["<solver_session>.first_last (Object)"]

@hpohekar
Copy link
Collaborator Author

@hpohekar we'll check if any change in required for PyConsole after merging this PR

@mkundu1 Sure.

@hpohekar
Copy link
Collaborator Author

hpohekar commented Nov 21, 2024

@hpohekar Can you please add this test?

api_tree_data = {
    "api_objects": [
        "<solver_session>.first_last (Object)",
        "<solver_session>.none (Object)",
    ],
    ...
}
assert pyfluent.search("first", match_whole_word=True) == ["<solver_session>.first_last (Object)"]
assert pyfluent.search("last", match_whole_word=True) == ["<solver_session>.first_last (Object)"]
# It is OK if we don't support the following - the above 2 are more important
assert pyfluent.search("first_last", match_whole_word=True) == ["<solver_session>.first_last (Object)"]

@mkundu1

We are supporting all 3 tests.

Done. Thank you.

@hpohekar
Copy link
Collaborator Author

@hpohekar We don't support search_root in the new search function. Feel free to clean up the function _get_version_path_prefix_from_obj and relevant tests (in same or different PR).

@mkundu1 Removed. Thank you.

@hpohekar
Copy link
Collaborator Author

@seanpearsonuk @mkundu1 We have implemented all suggestions and added more tests. Let me know if you want to add any specific test cases. Thank you.

Copy link
Contributor

@mkundu1 mkundu1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The present changes look good to me, thanks. There is one issue related to the presentationof the results, will file a separate defect.

@hpohekar
Copy link
Collaborator Author

The present changes look good to me, thanks. There is one issue related to the presentationof the results, will file a separate defect.

Sure. Please go ahead. Thank you.

@hpohekar hpohekar merged commit bbc8ecc into main Nov 21, 2024
29 checks passed
@hpohekar hpohekar deleted the feat/search_module_improvements branch November 21, 2024 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants