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

Made temporary changes to include multiple keywords in rustdoc search #11438

Merged
merged 1 commit into from Jan 14, 2014
Merged

Made temporary changes to include multiple keywords in rustdoc search #11438

merged 1 commit into from Jan 14, 2014

Conversation

eastwood
Copy link
Contributor

cc @cmr

Temporary change to issue #10535. Requires significant re-factoring to search completely based on the index paths. For example searching for "File::" in this fix will return no results. Still need to search completely based on path (rather than name's + types) to completely fix. Will continue to work this

@adrientetar
Copy link
Contributor

cc @alexcrichton

@@ -96,6 +96,11 @@
document.location.href = url;
});

function stripQuery(query) {
var strippedQuery = query.split("::");
return strippedQuery[strippedQuery.length - 1];
Copy link
Member

Choose a reason for hiding this comment

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

If you search for File::, doesn't this end up querying ""?

Copy link
Member

Choose a reason for hiding this comment

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

This seems kinda wrong discarding everything but the last identifier in the path, in theory you have a lot more contextual information, right?

I think this is ok for now (today's behavior is nothing!), but I am concerned about searching for empty strings.

@eastwood
Copy link
Contributor Author

Completely agree, this is a temporary fix until I get the results.path working correctly, I wouldn't close the issue until this is

@eastwood eastwood closed this Jan 10, 2014
@eastwood eastwood reopened this Jan 11, 2014
@eastwood
Copy link
Contributor Author

cc @alexcrichton

Continuing on, the data available for a search is like this:

File::open =>

Object {ty: "method", name: "open", path: "std::io::fs", desc: "Attempts to open a file in read-only mode.....", parent: "136298"}

Parent node =>

Object {type: "struct", name: "File"} 

The parent has to be searched also for a correct keyword. Currently, the implementation will search and combine for both keywords (File && open).

Though, I think that it would be more suitable if the results returned ONLY entries that contain the keywords (File && open).

So for example, searching for File::open should return:

  • std::io::FileMode::Open
  • std::io::fs::File::open
  • std::io::fs::File::open_mode
  • etc.

Rather than results like this:

  • std::libc::consts::os::posix01::_SC_XOPEN_SHM

Let me know your thoughts. I can have this done soon.

@alexcrichton
Copy link
Member

Sounds awesome! So long as all information given in the search is semantically considered, then that's fine by me!

@eastwood
Copy link
Contributor Author

screenshot from 2014-01-14 13 29 57
std

Hey Alex,
Got the path searching working, give it a go and let me know. Peforms the following logic, for example "file::open":

(file && open) exists in (name || path || *parent)

@alexcrichton
Copy link
Member

Awesome, nice job! Would you mind rebasing your commits into one? Otherwise this looks good to go!

Made temporary changes to include multiple keywords in rustdoc search

Implemented search based on multiple keywords

Added some commenting and house cleaning

Added path searching to rustdoc
@eastwood
Copy link
Contributor Author

Done

bors added a commit that referenced this pull request Jan 14, 2014
cc @cmr

Temporary change to issue #10535. Requires significant re-factoring to search completely based on the index paths. For example searching for "File::" in this fix will return no results. Still need to search completely based on path (rather than name's + types) to completely fix. Will continue to work this
@bors bors closed this Jan 14, 2014
@bors bors merged commit 9a45c9d into rust-lang:master Jan 14, 2014
@eastwood eastwood deleted the rust-doc branch January 15, 2014 00:17
@eastwood eastwood restored the rust-doc branch January 15, 2014 01:11
flip1995 pushed a commit to flip1995/rust that referenced this pull request Dec 16, 2023
new lint to detect infinite loop

closes: rust-lang#11438

changelog: add new lint to detect infinite loop

~*I'll change the lint name*~. Should I name it  `infinite_loop` or `infinite_loops` is fine? Ahhhh, English is hard...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants