[recoll-user] Re: Indexing python Files

  • From: Jean-Francois Dockes <jean-francois.dockes@xxxxxxxxxx>
  • To: recoll-user@xxxxxxxxxxxxx
  • Date: Fri, 12 Sep 2008 12:55:08 +0200

Hi Linos,

You can't just say "text/x-python = internal", this would suppose that the
c++ code  knows what to do with text/x-python, which it doesnt

You have 2 possibilities:
1- Either add something like the following to mimemap:

.py = text/plain

 Then python files will just be indexed as text, but you lose the ability
 to have a specific viewer/icons etc.


2- Or add ".py = text/x-python" to mimemap, but then you need to add a
   filter script for python files. Add something like the following to
   mimeconf: 

text/x-python = exec rclpython

 - The rclpython script (which might be written in python by the way...)
   would need to turn the python program into html. Minimally, this means
   emitting a charset meta tag, and just emitting the python text after
   escaping characters like "<", "&". For a simple example, take a look at
   rclman. In fact, I should write a script that would generically do this
   to any text file, maybe I'll do it for the next release.
   Alternatively, maybe someone already wrote a program to turn a python
   program into nice html, then you could just call this from the script.
   The regular rcl... script also do other stuff like checking for external
   programs and emitting specific erors etc., but this is not strictly
   needed, you just need to spit html

Don't hesitate to come back to me if anything is unclear. If you go the
script way and you like the results, I'd be glad to add it to the
distribution so that it will be there for you next release...

Regards,
jf

Linos writes:
 > 
 > Hello,
 >      i am trying to get recoll index my python source files, but i am doing 
 > anything 
 > wrong because i cant get it to work, i have added this files to my ~/.recoll 
 > directory.
 > 
 > mimeconf
 > [index]
 > text/x-python = internal
 > 
 > [icons]
 > text/x-python = txt
 > 
 > [categories]
 > text = \
 >        text/x-python
 > 
 > mimemap
 > .py = text/x-python
 > 
 > mimeview
 > text/x-python = kwrite %f
 > 
 > in the gui interface i can select the type to filter it in advanced search 
 > if i 
 > want, but i dont get the files really indexed, only his names, i cant search 
 > the 
 > content, obviously the viewer and icon are only to text the indexing 
 > function 
 > later i will make it use better editor/icon, i have tried recreating the 
 > complete xapiandb with recollindex -z, and other question, if i add new 
 > types 
 > (when you help me with the correct way to do it hehehe) do i have to 
 > recreate 
 > the complete index if the files has not been changed and are in a 
 > subdirectory 
 > previously indexed?
 > 

Other related posts: