[fpc-pascal] Add API to official documentation search

Michael Van Canneyt michael at freepascal.org
Mon Nov 18 19:15:22 CET 2019



On Mon, 18 Nov 2019, Ryan Joseph via fpc-pascal wrote:

>
>
>> On Nov 17, 2019, at 5:20 PM, Michael Van Canneyt <michael at freepascal.org> wrote:
>> 
>> That would be me.
>> 
>> And there already is an API. How else ? This is Free Pascal !
>
> Sorry for the late response.
>
> Nice this is exactly what I wanted.  However when I started to look at the
> actual results I'm confused.  For my example of searching for "list" here
> is the first result:
>
>
> FCL units reference	tfpobjectlist.html
> Return the first non-nil object in the list

> What is this exactly?  I expected to get results like from
> https://docs.getlazarus.org where it would say this is a class or a method
> etc...  and a description of the class.  I had been using their API
> (Anthony is responsible for the project I think) but its got bugs and I
> haven't been able to contact the developer to fix them.

You get a list of pages that contain the search term. They are listed in
order of amount of hits in the page.

>
> What if I want to see the reference for TStringList?  If I enter that term
> I get lots of results but all I have to go on is the "context" which
> doesn't really tell me what the result is how to filter it.

If you want exact matches on class names or identifiers, then there is no such API.

Such an API can be conceived, but does not exist at present. 
Should be easy enough to do, I suppose.

As with all things FPC, the sources are available:

svn co https://svn.freepascal.org/svn/html/docsearch docsearch

Feel free to suggest improvements. It should be easy enough to add a first
element that contains an exact match on one or more identifiers by looking
for a file with the correct name, given an initial directory.

Michael.


More information about the fpc-pascal mailing list